From 5ac71729d8052bb21306a9ea452835733a1f06b0 Mon Sep 17 00:00:00 2001 From: borg-0300 Date: Tue, 5 Feb 2008 16:54:45 +0000 Subject: [PATCH] small change git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4448 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/transfer.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/htroot/yacy/transfer.java b/htroot/yacy/transfer.java index 7f13dbc3f..e8ff86ca6 100644 --- a/htroot/yacy/transfer.java +++ b/htroot/yacy/transfer.java @@ -81,22 +81,26 @@ public final class transfer { prop.put("process_path", ""); prop.put("process_maxsize", "0"); - final yacySeed otherseed = yacyCore.seedDB.get(otherpeer); - if (otherseed == null || sb.isRobinsonMode() || !sb.rankingOn) { + if (sb.isRobinsonMode() || !sb.rankingOn) { // in a robinson environment, do not answer. We do not do any transfer in a robinson cluster. return prop; } - otherseed.setLastSeenUTC(); - if (filename.indexOf("..") >= 0) { + final yacySeed otherPeer = yacyCore.seedDB.get(otherpeer); + if (otherPeer == null) { // reject unknown peers: this does not appear fair, but anonymous senders are dangerous + sb.getLog().logFine("RankingTransmission: rejected unknown peer '" + otherpeer + "', current IP " + header.get("CLIENTIP", "unknown")); + return prop; + } + otherPeer.setLastSeenUTC(); + + if (filename.indexOf("..") >= 0) { // reject paths that contain '..' because they are dangerous - if (otherseed == null) sb.getLog().logFine("RankingTransmission: rejected unknown peer '" + otherpeer + "', current IP " + header.get("CLIENTIP", "unknown")); - if (filename.indexOf("..") >= 0) sb.getLog().logFine("RankingTransmission: rejected wrong path '" + filename + "' from peer " + otherseed.getName() + "/" + otherseed.getPublicAddress()+ ", current IP " + header.get("CLIENTIP", "unknown")); + sb.getLog().logFine("RankingTransmission: rejected wrong path '" + filename + "' from peer " + otherPeer.getName() + "/" + otherPeer.getPublicAddress()+ ", current IP " + header.get("CLIENTIP", "unknown")); return prop; } - String otherpeerName = otherseed.hash + ":" + otherseed.getName(); + String otherpeerName = otherPeer.hash + ":" + otherPeer.getName(); if (process.equals("permission")) { prop.put("process", "0");