From 2674d28ef4b555c1374d27262c539e595b780715 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 1 Aug 2013 12:35:44 +0200 Subject: [PATCH] protection against self-ping (may be cause by fraud attempts) --- htroot/yacy/hello.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 014ab723b..7e27d4684 100644 --- a/htroot/yacy/hello.java +++ b/htroot/yacy/hello.java @@ -113,8 +113,14 @@ public final class hello { final String reportedPeerType = remoteSeed.get(Seed.PEERTYPE, Seed.PEERTYPE_JUNIOR); final double clientversion = remoteSeed.getVersion(); + if ((reportedip + ':' + remoteSeed.getPort()).equals(sb.peers.mySeed().getPublicAddress())) { + // reject a self-ping + prop.put("message", "I am I"); + return prop; + } + if (sb.isRobinsonMode() && !sb.isPublicRobinson()) { - // if we are a robinson cluster, answer only if this client is known by our network definition + // if we are a robinson cluster, answer only if this client is known by our network definition prop.put("message", "I am robinson, I do not answer"); return prop; }