Explorar o código

* Fixed not checking for o|o in .cmd * cmds.
* Fixed private() checking in cmd_getkey


svn: 954

Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
5a6255787c
Modificáronse 2 ficheiros con 45 adicións e 5 borrados
  1. 3 0
      doc/UPDATES
  2. 42 5
      src/mod/irc.mod/cmdsirc.c

+ 3 - 0
doc/UPDATES

@@ -18,6 +18,9 @@ This is a summary of ChangeLog basically.
 14.Several msgc cmds were replying incorrectly, fixed.
 14.Several msgc cmds were replying incorrectly, fixed.
 15.Fixed the bad uname email not giving the login.
 15.Fixed the bad uname email not giving the login.
 16.SIGTERM now kills the bot.
 16.SIGTERM now kills the bot.
+17.Cmds: voice, devoice, op, deop, invite, mop, kick, kickban now check if the user 
+   issuing the cmd has access for the channel.
+18.cmd_getkey now recognizes +private.
 
 
 1.1.5
 1.1.5
 
 

+ 42 - 5
src/mod/irc.mod/cmdsirc.c

@@ -193,7 +193,11 @@ static void cmd_kickban(struct userrec *u, int idx, char *par)
       dprintf(idx, "No such channel.\n");
       dprintf(idx, "No such channel.\n");
       return;
       return;
     }
     }
-
+    else if (!chk_op(user, chan)) {
+      if (all) goto next;
+      dprintf(idx, "You don't have access to %s\n", chan->dname);
+      return;
+    }
     if (!channel_active(chan)) {
     if (!channel_active(chan)) {
       if (all) goto next;
       if (all) goto next;
       dprintf(idx, "I'm not on %s right now!\n", chan->dname);
       dprintf(idx, "I'm not on %s right now!\n", chan->dname);
@@ -206,7 +210,6 @@ static void cmd_kickban(struct userrec *u, int idx, char *par)
       return;
       return;
     }
     }
 
 
-
     m = ismember(chan, nick);
     m = ismember(chan, nick);
     if (!m) {
     if (!m) {
       if (all) goto next;
       if (all) goto next;
@@ -302,6 +305,11 @@ static void cmd_voice(struct userrec *u, int idx, char *par)
       dprintf(idx, "No such channel.\n");
       dprintf(idx, "No such channel.\n");
       return;
       return;
     }
     }
+    else if (!chk_voice(user, chan) && !chk_op(user, chan)) {
+      if (all) goto next;
+      dprintf(idx, "You don't have access to voice on %s\n", chan->dname);
+      return;
+    }
 
 
     if (!channel_active(chan)) {
     if (!channel_active(chan)) {
       if (all) goto next;
       if (all) goto next;
@@ -365,6 +373,11 @@ static void cmd_devoice(struct userrec *u, int idx, char *par)
     dprintf(idx, "No such channel.\n");
     dprintf(idx, "No such channel.\n");
     return;
     return;
   }
   }
+  else if (!chk_voice(user, chan) && !chk_op(user, chan)) {
+    if (all) goto next;
+    dprintf(idx, "You don't have access to devoice on %s\n", chan->dname);
+    return;
+  }
 
 
   if (!channel_active(chan)) {
   if (!channel_active(chan)) {
     if (all) goto next;
     if (all) goto next;
@@ -428,6 +441,11 @@ static void cmd_op(struct userrec *u, int idx, char *par)
       dprintf(idx, "No such channel.\n");
       dprintf(idx, "No such channel.\n");
     goto next;
     goto next;
   }
   }
+  else if (!chk_op(user, chan)) {
+    if (all) goto next;
+    dprintf(idx, "You don't have access to op on %s\n", chan->dname);
+    return;
+  }
 
 
   if (!channel_active(chan)) {
   if (!channel_active(chan)) {
     if (all) goto next;
     if (all) goto next;
@@ -449,7 +467,7 @@ static void cmd_op(struct userrec *u, int idx, char *par)
   egg_snprintf(s, sizeof s, "%s!%s", m->nick, m->userhost);
   egg_snprintf(s, sizeof s, "%s!%s", m->nick, m->userhost);
   u = get_user_by_host(s);
   u = get_user_by_host(s);
   get_user_flagrec(u, &victim, chan->dname);
   get_user_flagrec(u, &victim, chan->dname);
-  if (chan_deop(victim) || (glob_deop(victim) && !glob_op(victim))) {
+  if (chk_deop(victim, chan)) {
     dprintf(idx, "%s is currently being auto-deopped  on %s.\n", m->nick, chan->dname);
     dprintf(idx, "%s is currently being auto-deopped  on %s.\n", m->nick, chan->dname);
     if (all) goto next;
     if (all) goto next;
     return;
     return;
@@ -768,6 +786,11 @@ static void cmd_deop(struct userrec *u, int idx, char *par)
       if (all) goto next;
       if (all) goto next;
       dprintf(idx, "No such channel.\n");
       dprintf(idx, "No such channel.\n");
     }
     }
+    else if (!chk_op(user, chan)) {
+      if (all) goto next;
+      dprintf(idx, "You don't have access to deop on %s\n", chan->dname);
+      return;
+    }
     if (!channel_active(chan)) {
     if (!channel_active(chan)) {
       if (all) goto next;  
       if (all) goto next;  
       dprintf(idx, "I'm not on %s right now!\n", chan->dname);
       dprintf(idx, "I'm not on %s right now!\n", chan->dname);
@@ -861,6 +884,11 @@ static void cmd_kick(struct userrec *u, int idx, char *par)
       dprintf(idx, "No such channel.\n");
       dprintf(idx, "No such channel.\n");
       return;
       return;
     }
     }
+    else if (!chk_op(user, chan)) {
+      if (all) goto next;
+      dprintf(idx, "You don't have access to kick on %s\n", chan->dname);
+      return;
+    }
 
 
     if (!channel_active(chan)) {
     if (!channel_active(chan)) {
       if (all) goto next;
       if (all) goto next;
@@ -922,8 +950,12 @@ static void cmd_getkey(struct userrec *u, int idx, char *par)
 
 
   get_user_flagrec(dcc[idx].user, &user, chan->dname);
   get_user_flagrec(dcc[idx].user, &user, chan->dname);
 
 
-  if (!glob_op(user) && !chan_op(user)) {
-    dprintf(idx, "You do not have access for %s\n");
+  if (private(user, chan, PRIV_OP)) {
+    dprintf(idx, "No such channel.\n");
+    return;
+  }
+  else if (!chk_op(user, chan)) {
+    dprintf(idx, "You don't have access for %s\n");
     return;
     return;
   }
   }
 
 
@@ -1125,6 +1157,11 @@ static void cmd_invite(struct userrec *u, int idx, char *par)
       if (all) goto next;
       if (all) goto next;
       dprintf(idx, "No such channel.\n");
       dprintf(idx, "No such channel.\n");
     }
     }
+    else if (!chk_op(user, chan)) {
+      if (all) goto next;
+      dprintf(idx, "You don't have access to op on %s\n", chan->dname);
+      return;
+    }
 
 
     if (!me_op(chan)) {
     if (!me_op(chan)) {
       if (all) goto next;
       if (all) goto next;