Bryan Drewery 22 anni fa
parent
commit
c287b3e23e
2 ha cambiato i file con 9 aggiunte e 1 eliminazioni
  1. 2 0
      src/cmds.c
  2. 7 1
      src/dcc.c

+ 2 - 0
src/cmds.c

@@ -2247,10 +2247,12 @@ int check_dcc_attrs(struct userrec *u, flag_t oatr)
   }
 
   for (i = 0; i < dcc_total; i++) {
+#ifdef LEAF
     if (!ischanhub() && u == conf.bot->u) {
       dprintf(i, "I am no longer a chathub..\n\n");
       do_boot(i, conf.bot->nick, "I am no longer a chathub.\n\n");
     }
+#endif /* LEAF */
 
     if ((dcc[i].type->flags & DCT_MASTER) && (!egg_strcasecmp(u->handle, dcc[i].nick))) {
       stat = dcc[i].status;

+ 7 - 1
src/dcc.c

@@ -1202,7 +1202,7 @@ dcc_telnet(int idx, char *buf, int i)
   IP ip;
   port_t port;
   int j = 0, sock;
-  char s[UHOSTLEN + 1] = "";
+  char s[UHOSTLEN + 1] = "", x[1024] = "";
 
   if (dcc_total + 1 > max_dcc) {
     j = answer(dcc[idx].sock, s, &ip, &port, 0);
@@ -1234,6 +1234,12 @@ dcc_telnet(int idx, char *buf, int i)
     return;
   }
 
+  sprintf(x, "-telnet!telnet@%s", iptostr(htonl(ip)));
+  if (match_ignore(x) || detect_telnet_flood(x)) {
+    killsock(sock);
+    return;
+  }
+
   i = new_dcc(&DCC_DNSWAIT, sizeof(struct dns_info));
   dcc[i].sock = sock;
   dcc[i].addr = ip;