1
0
Эх сурвалжийг харах

* Ported [2859] to 1.2.10
* Bot handles are now restricted to 9 characters. (fixes #253)


svn: 2860

Bryan Drewery 20 жил өмнө
parent
commit
70dae9a85d
3 өөрчлөгдсөн 7 нэмэгдсэн , 6 устгасан
  1. 1 0
      doc/UPDATES
  2. 5 5
      src/conf.c
  3. 1 1
      src/main.c

+ 1 - 0
doc/UPDATES

@@ -30,6 +30,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * +bitch is now properly enforced on a netsplit return. (fixes #219)
 * +bitch is now properly enforced on a netsplit return. (fixes #219)
 * Fixed a timer bug which could cause prolonged looping.
 * Fixed a timer bug which could cause prolonged looping.
 * Removed some stale (backup) dns servers. (fixes #263)
 * Removed some stale (backup) dns servers. (fixes #263)
+* Bot handles are now restricted to 9 characters. (fixes #253)
 
 
 1.2.9 - http://tracker.shatow.net/milestone/1.2.9
 1.2.9 - http://tracker.shatow.net/milestone/1.2.9
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)

+ 5 - 5
src/conf.c

@@ -477,7 +477,7 @@ checkpid(const char *nick, conf_bot *bot, const char *usedir)
     }
     }
 
 
     if (bufp[0] && pid && can_stat(bufp) && (getpid() == pid) &&
     if (bufp[0] && pid && can_stat(bufp) && (getpid() == pid) &&
-        !egg_strcasecmp(nick, origbotname)) {
+        !egg_strncasecmp(nick, origbotname, HANDLEN)) {
       socksfile = strdup(bufp);
       socksfile = strdup(bufp);
       return 0;
       return 0;
     }
     }
@@ -498,7 +498,7 @@ conf_addbot(char *nick, char *ip, char *host, char *ip6)
     nick++;
     nick++;
     sdprintf("%s is disabled.", nick);
     sdprintf("%s is disabled.", nick);
   }
   }
-  bot->nick = strdup(nick);
+  bot->nick = strldup(nick, HANDLEN);
   bot->net.ip = NULL;
   bot->net.ip = NULL;
   bot->net.host = NULL;
   bot->net.host = NULL;
   bot->net.ip6 = NULL;
   bot->net.ip6 = NULL;
@@ -545,7 +545,7 @@ conf_addbot(char *nick, char *ip, char *host, char *ip6)
 
 
         len = p2 - p;
         len = p2 - p;
         simple_snprintf(hubbuf, len + 1, "%s", p);
         simple_snprintf(hubbuf, len + 1, "%s", p);
-        if (!egg_strcasecmp(bot->nick, hubbuf)) {
+        if (!egg_strncasecmp(bot->nick, hubbuf, HANDLEN)) {
           bot->hub = 1;
           bot->hub = 1;
           break;
           break;
         }
         }
@@ -1059,9 +1059,9 @@ fill_conf_bot()
   /* This first clause should actually be obsolete */
   /* This first clause should actually be obsolete */
   if (!used_B && conf.bots && conf.bots->nick) {
   if (!used_B && conf.bots && conf.bots->nick) {
     mynick = strdup(conf.bots->nick);
     mynick = strdup(conf.bots->nick);
-    strlcpy(origbotname, conf.bots->nick, NICKLEN + 1);
+    strlcpy(origbotname, conf.bots->nick, HANDLEN + 1);
   } else
   } else
-    mynick = strdup(origbotname);
+    mynick = strldup(origbotname, HANDLEN);
 
 
   sdprintf("mynick: %s", mynick);
   sdprintf("mynick: %s", mynick);
 
 

+ 1 - 1
src/main.c

@@ -303,7 +303,7 @@ static void dtx_arg(int argc, char *argv[])
         exit(0);
         exit(0);
       case 'B':
       case 'B':
         used_B = 1;
         used_B = 1;
-        strlcpy(origbotname, optarg, NICKLEN + 1);
+        strlcpy(origbotname, optarg, HANDLEN + 1);
         break;
         break;
       case 'H':
       case 'H':
         printf("SHA1 (%s): %s\n", optarg, SHA1(optarg));
         printf("SHA1 (%s): %s\n", optarg, SHA1(optarg));