Просмотр исходного кода

* Ported [2764] to 1.2.10
* Fixed an invalid socket warning with failed relay. (fixes #216)


svn: 2765

Bryan Drewery 20 лет назад
Родитель
Сommit
876b4271ff
2 измененных файлов с 9 добавлено и 3 удалено
  1. 1 0
      doc/UPDATES
  2. 8 3
      src/botnet.c

+ 1 - 0
doc/UPDATES

@@ -16,6 +16,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed a major security hole in cmdpass checking.
 * cmd_chhandle can no longer be used on bots. (fixes #224)
 * Revised help listing for 'auth-chan' in 'help set'. (fixes #229)
+* Fixed an invalid socket warning with failed relay. (fixes #216)
 
 1.2.9
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)

+ 8 - 3
src/botnet.c

@@ -1080,8 +1080,10 @@ static void failed_tandem_relay(int idx)
   }
   if (uidx < 0) {
     putlog(LOG_MISC, "*", "Can't find user for relay!  %d -> %d", dcc[idx].sock, dcc[idx].u.relay->sock);
-    if (dcc[idx].sock != -1)
+    if (dcc[idx].sock != -1) {
       killsock(dcc[idx].sock);
+      dcc[idx].sock = -1;
+    }
     lostdcc(idx);
     return;
   }
@@ -1093,8 +1095,10 @@ static void failed_tandem_relay(int idx)
   free(dcc[uidx].u.relay);
   dcc[uidx].u.chat = ci;
   dcc[uidx].type = &DCC_CHAT;
-  if (dcc[idx].sock != -1)
+  if (dcc[idx].sock != -1) {
     killsock(dcc[idx].sock);
+    dcc[idx].sock = -1;
+  }
   lostdcc(idx);
   return;
 }
@@ -1482,7 +1486,8 @@ static void dcc_relaying(int idx, char *buf, int j)
   dcc[idx].u.chat = ci;
   dcc[idx].type = &DCC_CHAT;
   check_bind_chon(dcc[idx].nick, idx);
-  killsock(dcc[j].sock);
+  if (dcc[j].sock != -1)
+    killsock(dcc[j].sock);
   lostdcc(j);
 }