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

* Potential bug fixed.

svn: 895
Bryan Drewery 22 лет назад
Родитель
Сommit
19473c3093
4 измененных файлов с 6 добавлено и 50 удалено
  1. 1 0
      doc/UPDATES
  2. 3 1
      src/dcc.c
  3. 2 1
      src/misc.c
  4. 0 48
      src/mod/update.mod/update.c

+ 1 - 0
doc/UPDATES

@@ -6,6 +6,7 @@ This is a summary of ChangeLog basically.
 2.Checksum is now calculated and added to binary during compile.
 3.Fixed a bug in transfer/update which caused transfers to fail often.
 4.Segfault fix in cmd_debug.
+5.Fixed a potential bug in share.
 
 1.1.4
 

+ 3 - 1
src/dcc.c

@@ -359,8 +359,10 @@ static void cont_link(int idx, char *buf, int ii)
     getsockname(socklist[snum].sock, (struct sockaddr *) &sa, &i);
     egg_snprintf(tmp, sizeof tmp, "%s@%4x@%s@%s", bdhash, sa.sin_port, dcc[idx].nick, conf.bot->nick);
     strncpyz(socklist[snum].ikey, SHA1(tmp), sizeof(socklist[snum].ikey));
+    /*
     putlog(LOG_DEBUG, "@", "Link hash for %s: %s", dcc[idx].nick, tmp);
     putlog(LOG_DEBUG, "@", "initkey (%d): %s", strlen(socklist[snum].ikey), socklist[snum].ikey);
+    */
     /* We've send our conf.bot->nick and set the key for the link on the sock, wait for 'elink' back to verify key */
     socklist[snum].encstatus = 1;
     socklist[snum].gz = 1;
@@ -386,7 +388,7 @@ static void dcc_bot_new(int idx, char *buf, int x)
   } else if (!egg_strcasecmp(code, "elink")) {
     int snum = -1;
 
-    putlog(LOG_DEBUG, "*", "Got elink: %s %s", code, buf);
+    /* putlog(LOG_DEBUG, "*", "Got elink: %s %s", code, buf); */
     /* Set the socket key and we're linked */
     for (i = 0; i < MAXSOCKS; i++) {
       if (!(socklist[i].flags & SOCK_UNUSED) && (socklist[i].sock == dcc[idx].sock)) {

+ 2 - 1
src/misc.c

@@ -776,12 +776,12 @@ int updatebin(int idx, char *par, int autoi)
   listen_all(my_port, 1); /* close the listening port... */
   usleep(5000);
 #endif /* HUB */
-  putlog(LOG_DEBUG, "*", "Running for update: %s", buf);
 #ifdef LEAF
   if (!autoi && localhub) {
     /* let's drop the server connection ASAP */
     nuke_server("Updating...");
 #endif /* LEAF */
+    putlog(LOG_DEBUG, "*", "Running for update: %s", buf);
     logidx(idx, "Updating...bye");
     putlog(LOG_MISC, "*", "Updating...");
     botnet_send_chat(-1, conf.bot->nick, "Updating...");
@@ -796,6 +796,7 @@ int updatebin(int idx, char *par, int autoi)
     egg_timeval_t howlong;
 
     egg_snprintf(buf, sizeof buf, "%s -L %s -P %d", binname, conf.bot->nick, getpid());	
+    putlog(LOG_DEBUG, "*", "Running for update: %s", buf);
     /* will exit after run, cron will restart us later */
     system(buf);
 

+ 0 - 48
src/mod/update.mod/update.c

@@ -31,7 +31,6 @@
 
 /* Prototypes */
 static void start_sending_binary(int);
-static void cancel_user_xfer(int, void *);
 
 #include "update.h"
 
@@ -351,51 +350,6 @@ static void start_sending_binary(int idx)
 #endif /* HUB */
 }
 
-static void (*def_dcc_bot_kill) (int, void *) = 0;
-
-static void cancel_user_xfer(int idx, void *x)
-{
-  int i, j, k = 0;
-
-  if (idx < 0) {
-    idx = -idx;
-    k = 1;
-    updatebot(-1, dcc[idx].nick, '-', 0);
-  }
-  if (dcc[idx].status & STAT_SHARE) {
-    if (dcc[idx].status & STAT_GETTINGU) {
-      j = 0;
-      for (i = 0; i < dcc_total; i++)
-	if (!egg_strcasecmp(dcc[i].host, dcc[idx].nick) &&
-	    ((dcc[i].type->flags & (DCT_FILETRAN | DCT_FILESEND)) ==
-	     (DCT_FILETRAN | DCT_FILESEND)))
-	  j = i;
-      if (j != 0) {
-	killsock(dcc[j].sock);
-	unlink(dcc[j].u.xfer->filename);
-	lostdcc(j);
-      }
-      putlog(LOG_BOTS, "*", "(Userlist download aborted.)");
-    }
-    if (dcc[idx].status & STAT_SENDINGU) {
-      j = 0;
-      for (i = 0; i < dcc_total; i++)
-	if ((!egg_strcasecmp(dcc[i].host, dcc[idx].nick)) &&
-	    ((dcc[i].type->flags & (DCT_FILETRAN | DCT_FILESEND))
-	     == DCT_FILETRAN))
-	  j = i;
-      if (j != 0) {
-	killsock(dcc[j].sock);
-	unlink(dcc[j].u.xfer->filename);
-	lostdcc(j);
-      }
-      putlog(LOG_BOTS, "*", "(Userlist transmit aborted.)");
-    }
-  }
-  if (!k)
-    def_dcc_bot_kill(idx, x);
-}
-
 #ifdef HUB
 int cnt = 0;
 static void check_updates()
@@ -503,6 +457,4 @@ void update_init()
   add_builtins("dcc", update_cmds);
   timer_create_secs(30, "check_updates", (Function) check_updates);
 #endif /* HUB */
-  def_dcc_bot_kill = DCC_BOT.kill;
-  DCC_BOT.kill = cancel_user_xfer;
 }