Skip to content

Commit

Permalink
in IntranetMode allow intranet hosted seedlist with Network_Domain "any"
Browse files Browse the repository at this point in the history
- so far intranet seedlist hosts are always denied but need to be allowed in intranet mode
  • Loading branch information
reger committed Aug 24, 2014
1 parent b4226ed commit 350c6b8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions source/net/yacy/peers/Seed.java
Expand Up @@ -581,7 +581,7 @@ public final int getRevision() {
public final String getPublicAddress() {
String ip = getIP();
if (ip == null) ip = Domains.LOCALHOST; // that should not happen

int p = ip.lastIndexOf(':');
if (p > 0 && (ip.indexOf(':') == p || "]:".equals(ip.substring(p - 1, p + 1)))) return ip; // includes already the port

Expand Down Expand Up @@ -1117,7 +1117,15 @@ public final String isProper(final boolean checkOwnIP) {
final URL url = new URL(seedURL);
final String host = url.getHost();
if (Domains.isIntranet(host)) {
return "seedURL in local network rejected";
// network.unit.domain = any returns isIntranet() always true (because noLocalCheck is set true)
// but seedlist on intranet host must be allowed -> check for intranet mode and deny "localhost" or loopback IP
if (Switchboard.getSwitchboard().isIntranetMode() ) {
if (Domains.isLocalhost(host)) {
return "seedURL on local host rejected ("+host+")";
}
} else {
return "seedURL in local network rejected ("+host+")";
}
}
} catch (final MalformedURLException e ) {
return "seedURL malformed";
Expand Down

0 comments on commit 350c6b8

Please sign in to comment.