Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added checks to protect peers from wrong seeds see also: http://www.yacy-forum.de/viewtopic.php?p=19249#19249
orbiter59fc55ea1e6b
diff --git a/source/de/anomic/net/natLib.java b/source/de/anomic/net/natLib.javaindex 95008ac92..7a72dceff 100644--- a/source/de/anomic/net/natLib.java+++ b/source/de/anomic/net/natLib.java@@ -125,19 +125,20 @@ public class natLib {//TODO: This is not IPv6 compatiblepublic static boolean isProper(String ip) {- plasmaSwitchboard sb=plasmaSwitchboard.getSwitchboard();- if (sb == null) return false;- String yacyDebugMode = sb.getConfig("yacyDebugMode", "false");- if(yacyDebugMode.equals("true")){- return true;- }- //support for staticIP- if(sb.getConfig("staticIP", "").equals(ip)){- return true;- }- if (ip == null) return false;- if (ip.indexOf(":") >= 0) return false; // ipv6...- return ( isNotLocal(ip)) && (isIP(ip) );+ plasmaSwitchboard sb=plasmaSwitchboard.getSwitchboard();+ if (sb != null) {+ String yacyDebugMode = sb.getConfig("yacyDebugMode", "false");+ if (yacyDebugMode.equals("true")) {+ return true;+ }+ // support for staticIP+ if (sb.getConfig("staticIP", "").equals(ip)) {+ return true;+ }+ }+ if (ip == null) return false;+ if (ip.indexOf(":") >= 0) return false; // ipv6...+ return (isNotLocal(ip)) && (isIP(ip));}private static int retrieveOptions() {diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.javaindex 2fb5a6b91..b486f6d52 100644--- a/source/de/anomic/yacy/yacyPeerActions.java+++ b/source/de/anomic/yacy/yacyPeerActions.java@@ -400,6 +400,7 @@ public class yacyPeerActions {}public boolean peerArrival(yacySeed peer, boolean direct) {+ if (peer == null) return false;boolean res = connectPeer(peer, direct);// perform all actions if peer is effective newif (res) {@@ -410,6 +411,7 @@ public class yacyPeerActions {}public void peerDeparture(yacySeed peer) {+ if (peer == null) return;//System.out.println("PEER DEPARTURE:" + peer.toString());disconnectPeer(peer);// perform all actions@@ -418,6 +420,7 @@ public class yacyPeerActions {}public void peerPing(yacySeed peer) {+ if (peer == null) return;// this is called only if the peer has junior statusseedDB.addPotential(peer);// perform all actionsdiff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.javaindex 8e61c5835..81f24e0c9 100644--- a/source/de/anomic/yacy/yacySeed.java+++ b/source/de/anomic/yacy/yacySeed.java@@ -605,7 +605,9 @@ public class yacySeed {if (seed == null) { return null; }final HashMap dna = serverCodings.string2map(seed);final String hash = (String) dna.remove("Hash");- return new yacySeed(hash, dna);+ yacySeed resultSeed = new yacySeed(hash, dna);+ if (resultSeed.isProper() == null) return resultSeed;+ return null;}public String toString() {