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

* Ported [2445] to 1.2.9 (fixes #143)

svn: 2596
Bryan Drewery 20 лет назад
Родитель
Сommit
ff04713c4e
4 измененных файлов с 24 добавлено и 0 удалено
  1. 1 0
      doc/UPDATES
  2. 13 0
      src/dccutil.c
  3. 1 0
      src/dccutil.h
  4. 9 0
      src/mod/share.mod/share.c

+ 1 - 0
doc/UPDATES

@@ -27,6 +27,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed channel notices not being parsed.
 * Fixed channel notices not being parsed.
 * Took out all punish/revenge code, it's been disabled since 1.2.7 anyway.
 * Took out all punish/revenge code, it's been disabled since 1.2.7 anyway.
 * Fixed bots giving up on joining juped channels (may be due to split) (#168)
 * Fixed bots giving up on joining juped channels (may be due to split) (#168)
+* Fixed cmdpass list getting desynced during userfile transfer. (#143)
 
 
 1.2.8
 1.2.8
 * Fixed [bot]* cmds depending on case of botnicks.
 * Fixed [bot]* cmds depending on case of botnicks.

+ 13 - 0
src/dccutil.c

@@ -1023,6 +1023,7 @@ int has_cmd_pass(const char *cmd)
       return 1;
       return 1;
   return 0;
   return 0;
 }
 }
+
 void set_cmd_pass(char *ln, int shareit)
 void set_cmd_pass(char *ln, int shareit)
 {
 {
   struct cmd_pass *cp = NULL;
   struct cmd_pass *cp = NULL;
@@ -1064,3 +1065,15 @@ void set_cmd_pass(char *ln, int shareit)
       botnet_send_cmdpass(-1, cp->name, cp->pass);
       botnet_send_cmdpass(-1, cp->name, cp->pass);
   }
   }
 }
 }
+
+void cmdpass_free(struct cmd_pass *x) 
+{
+  struct cmd_pass *cp = NULL, *cp_n = NULL;
+
+  for (cp = x; cp; cp = cp_n) {
+    cp_n = cp->next;
+    list_delete((struct list_type **) &x, (struct list_type *) cp);
+    free(cp->name);
+    free(cp);
+  }
+}

+ 1 - 0
src/dccutil.h

@@ -59,6 +59,7 @@ void dcc_write(FILE *, int);
 int check_cmd_pass(const char *, char *);
 int check_cmd_pass(const char *, char *);
 int has_cmd_pass(const char *);
 int has_cmd_pass(const char *);
 void set_cmd_pass(char *, int);
 void set_cmd_pass(char *, int);
+void cmdpass_free(struct cmd_pass *);
 
 
 extern int		max_dcc;
 extern int		max_dcc;
 extern time_t		connect_timeout;
 extern time_t		connect_timeout;

+ 9 - 0
src/mod/share.mod/share.c

@@ -1239,6 +1239,11 @@ finish_share(int idx)
   if (conf.bot->u)
   if (conf.bot->u)
     conf.bot->u = NULL;
     conf.bot->u = NULL;
 
 
+  struct cmd_pass *old_cmdpass = NULL;
+
+  old_cmdpass = cmdpass;
+  cmdpass = NULL;
+
   /* Read the transferred userfile. Add entries to u, which already holds
   /* Read the transferred userfile. Add entries to u, which already holds
    * the bot entries in non-override mode.
    * the bot entries in non-override mode.
    */
    */
@@ -1265,6 +1270,8 @@ finish_share(int idx)
 
 
     Auth::FillUsers();
     Auth::FillUsers();
 
 
+    cmdpass = old_cmdpass;
+
     checkchans(2);              /* un-flag the channels, we are keeping them.. */
     checkchans(2);              /* un-flag the channels, we are keeping them.. */
 
 
     /* old userlist is now being used, safe to do this stuff... */
     /* old userlist is now being used, safe to do this stuff... */
@@ -1306,6 +1313,8 @@ finish_share(int idx)
   /* copy over any auth users */
   /* copy over any auth users */
   Auth::FillUsers();
   Auth::FillUsers();
 
 
+  cmdpass_free(old_cmdpass);
+
   checkchans(1);                /* remove marked channels */
   checkchans(1);                /* remove marked channels */
   var_parse_my_botset();
   var_parse_my_botset();
   reaffirm_owners();            /* Make sure my owners are +a   */
   reaffirm_owners();            /* Make sure my owners are +a   */