소스 검색

* Fix bots linking to the wrong hub not giving a good reason why they failed in the log. (fixes #369)

Bryan Drewery 17 년 전
부모
커밋
046177b780
2개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      doc/UPDATES
  2. 11 1
      src/dcc.c

+ 1 - 0
doc/UPDATES

@@ -28,6 +28,7 @@
 * Disable bot +f as all it did was cause a segfault. The flood code is unfinished. (fixes #429)
 * Fix cmd_slowjoin not counting bots correctly. (fixes #431)
 * Added telnet 'tcl expect' script in scripts/telnet.exp. Can be used for easier hub management over telnet from shell.
+* Fix bots linking to the wrong hub not giving a good reason why they failed in the log. (fixes #369)
 
 1.2.15.1
 * Fix leaf bots not updating behind other hubs (fixes #419)

+ 11 - 1
src/dcc.c

@@ -399,7 +399,7 @@ dcc_bot_new(int idx, char *buf, int x)
 
       sdprintf(STR("Choosing '%s' (%d/%d) for link"), enclink[i].name, enclink[i].type, i);
       link_hash(idx, rand);
-      dprintf(-dcc[idx].sock, STR("neg %s %d\n"), dcc[idx].shahash, enclink[i].type);
+      dprintf(-dcc[idx].sock, STR("neg %s %d %s\n"), dcc[idx].shahash, enclink[i].type, dcc[idx].nick);
       socklist[snum].enclink = i;
       link_link(idx, -1, i, TO);
     }
@@ -982,6 +982,16 @@ dcc_chat_pass(int idx, char *buf, int atr)
           lostdcc(idx);
           return;
         }
+
+        const char *expected_nick = newsplit(&buf);
+
+        if (egg_strcasecmp(expected_nick, conf.bot->nick)) {
+          putlog(LOG_WARN, "*", STR("%s failed encrypted link handshake (was expecting '%s' instead of me)"), dcc[idx].nick, expected_nick);
+          killsock(dcc[idx].sock);
+          lostdcc(idx);
+          return;
+        }
+
         socklist[snum].enclink = i;
 
         link_link(idx, -1, i, FROM);