Pārlūkot izejas kodu

* Ported [2760] to 1.2.10
* cmd_chhandle can no longer be used on bots. (fixes #224)


svn: 2761

Bryan Drewery 20 gadi atpakaļ
vecāks
revīzija
803e35b08a
3 mainītis faili ar 15 papildinājumiem un 6 dzēšanām
  1. 1 0
      doc/UPDATES
  2. 1 0
      misc/help.txt
  3. 13 6
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -14,6 +14,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Removed old references to '+/-manop' and '+/-nomop' for chaninfo in help file.
 * Removed old references to '+/-manop' and '+/-nomop' for chaninfo in help file.
 * Fixed auth cmds not working in privmsg. (fixes #228)
 * Fixed auth cmds not working in privmsg. (fixes #228)
 * Fixed a major security hole in cmdpass checking.
 * Fixed a major security hole in cmdpass checking.
+* cmd_chhandle can no longer be used on bots. (fixes #224)
 
 
 1.2.9
 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)

+ 1 - 0
misc/help.txt

@@ -607,6 +607,7 @@ See also: botcmd, channels, channel, status
    'gavroche' to 'jamie', you would use 'chhandle gavroche jamie'.
    'gavroche' to 'jamie', you would use 'chhandle gavroche jamie'.
  
  
    Perm owners may not change their handle without recompiling binaries first. 
    Perm owners may not change their handle without recompiling binaries first. 
+   Bot handles cannot be changed from partyline.
  
  
 See also: chpass%{+n}, chsecpass%{-}
 See also: chpass%{+n}, chsecpass%{-}
 ::chinfo
 ::chinfo

+ 13 - 6
src/cmds.c

@@ -1083,6 +1083,19 @@ static void cmd_chhandle(int idx, char *par)
     return;
     return;
   }
   }
 
 
+  struct userrec *u2 = get_user_by_handle(userlist, hand);
+
+  if (!u2) {
+    dprintf(idx, "No such handle!\n");
+    return;
+  }
+
+  if (u2->bot) {
+    dprintf(idx, "Sorry, bot handles cannot be changed from partyline.\n");
+    return;
+  }
+
+
   for (size_t i = 0; i < strlen(newhand); i++)
   for (size_t i = 0; i < strlen(newhand); i++)
     if ((newhand[i] <= 32) || (newhand[i] >= 127) || (newhand[i] == '@'))
     if ((newhand[i] <= 32) || (newhand[i] >= 127) || (newhand[i] == '@'))
       newhand[i] = '?';
       newhand[i] = '?';
@@ -1094,12 +1107,6 @@ static void cmd_chhandle(int idx, char *par)
   else if (get_user_by_handle(userlist, newhand) && egg_strcasecmp(hand, newhand))
   else if (get_user_by_handle(userlist, newhand) && egg_strcasecmp(hand, newhand))
     dprintf(idx, "Somebody is already using %s.\n", newhand);
     dprintf(idx, "Somebody is already using %s.\n", newhand);
   else {
   else {
-    struct userrec *u2 = get_user_by_handle(userlist, hand);
-
-    if (!u2) {
-      dprintf(idx, "No such handle!\n");
-      return;
-    }
     int atr = dcc[idx].user ? dcc[idx].user->flags : 0, atr2 = u2 ? u2->flags : 0;
     int atr = dcc[idx].user ? dcc[idx].user->flags : 0, atr2 = u2 ? u2->flags : 0;
 
 
     if (!(atr & USER_MASTER) && !u2->bot)
     if (!(atr & USER_MASTER) && !u2->bot)