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

* cmd_deluser change: only allow a |m user to remove users whom they have added.
(stops |m from removing users another |m added on another chan)


svn: 1782

Bryan Drewery 21 лет назад
Родитель
Сommit
aa6f46923a
3 измененных файлов с 8 добавлено и 1 удалено
  1. 1 0
      doc/UPDATES
  2. 1 0
      misc/help.txt
  3. 6 1
      src/mod/irc.mod/cmdsirc.c

+ 1 - 0
doc/UPDATES

@@ -16,6 +16,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed.
 * Fixed chanset (manop/mop/mdop/bad-cookie) to accept english parameters: ignore/deop/kick/delete/remove. 
 * cmd_cmdpass was not clear on usage.
 * Using a cmd with a cmdpass without proper flags now acts as if cmd is not valid (no longer spams wrong pass error)
+* cmd_deluser change: only allow a |m user to remove users whom they have added.
 
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 1 - 0
misc/help.txt

@@ -868,6 +868,7 @@ See also: encrypt, randstring, md5, sha1
    current hostname.  Channel masters can remove users so long as
    the user isn't a bot master.
  
+   Channel masters may only delete users which they added.
 see also: adduser%{+m}, +user, -user%{-}
 :leaf:deop
 ###  $bdeop$b <nickname> [channel|*]

+ 6 - 1
src/mod/irc.mod/cmdsirc.c

@@ -1599,7 +1599,7 @@ static void cmd_deluser(int idx, char *par)
     return;
   }
 
-  char *nick = NULL, s[UHOSTLEN] = "";
+  char *nick = NULL, s[UHOSTLEN] = "", *added = NULL;
   struct chanset_t *chan = NULL;
   memberlist *m = NULL;
   struct userrec *u = NULL;
@@ -1621,6 +1621,9 @@ static void cmd_deluser(int idx, char *par)
     dprintf(idx, "%s is not a valid user.\n", nick);
     return;
   }
+  added = (char *) get_user(&USERENTRY_ADDED, u);
+  newsplit(&added);
+
   get_user_flagrec(u, &victim, NULL);
   if (isowner(u->handle)) {
     dprintf(idx, "You can't remove a permanent bot owner!\n");
@@ -1634,6 +1637,8 @@ static void cmd_deluser(int idx, char *par)
     dprintf(idx, "You can't remove a channel master!\n");
   } else if (glob_bot(victim) && !glob_owner(user)) {
     dprintf(idx, "You can't remove a bot!\n");
+  } else if (!glob_master(user) && egg_strcasecmp(dcc[idx].nick, added)) {
+    dprintf(idx, "Sorry, you may not delete this user as you did not add them.\n");
   } else {
     char buf[HANDLEN + 1] = "";