Răsfoiți Sursa

* Fixed some missing sanity checking on certain user flags for channel records.

svn: 2015
Bryan Drewery 21 ani în urmă
părinte
comite
8a53fb3ce8
4 a modificat fișierele cu 11 adăugiri și 6 ștergeri
  1. 1 0
      doc/UPDATES
  2. 1 1
      src/cmds.c
  3. 8 4
      src/flags.c
  4. 1 1
      src/flags.h

+ 1 - 0
doc/UPDATES

@@ -83,6 +83,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed, or
 * Fixed dccauth not correctly working according to it's [bot]config setting (#30)
 * Fixed dccauth not correctly working according to it's [bot]config setting (#30)
 * Added match option for cmd_botcmd: '$' will match on all localhubs (first bot in config) (#28)
 * Added match option for cmd_botcmd: '$' will match on all localhubs (first bot in config) (#28)
 * Added some debug logging when a telnet connection is ignored.
 * Added some debug logging when a telnet connection is ignored.
+* Fixed some missing sanity checking on certain user flags for channel records.
 
 
 1.2.2
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 1 - 1
src/cmds.c

@@ -2489,7 +2489,7 @@ static void cmd_chattr(int idx, char *par)
     }
     }
     if (chan) {
     if (chan) {
       ocf = user.chan;
       ocf = user.chan;
-      user.chan = chan_sanity_check((user.chan | pls.chan) & ~mns.chan);
+      user.chan = chan_sanity_check((user.chan | pls.chan) & ~mns.chan, u2->bot);
     }
     }
     set_user_flagrec(u2, &user, par);
     set_user_flagrec(u2, &user, par);
   }
   }

+ 8 - 4
src/flags.c

@@ -75,11 +75,15 @@ sanity_check(flag_t atr, int bot)
 /* Sanity check on channel attributes
 /* Sanity check on channel attributes
  */
  */
 flag_t
 flag_t
-chan_sanity_check(flag_t chatr)
+chan_sanity_check(flag_t chatr, int bot)
 {
 {
-  /* admin for chan does shit.. */
-  if (chatr & USER_ADMIN)
-    chatr &= ~(USER_ADMIN);
+  /* these should only be global */
+  if (chatr & (USER_PARTY | USER_ADMIN | USER_HUBA | USER_CHUBA | USER_UPDATEHUB))
+    chatr &= ~(USER_PARTY | USER_ADMIN | USER_HUBA | USER_CHUBA | USER_UPDATEHUB);
+  /* these should only be set on bots */
+  if (!bot && (chatr & (USER_DOLIMIT | USER_DOVOICE | USER_CHANHUB)))
+    chatr &= ~(USER_DOLIMIT | USER_DOVOICE | USER_CHANHUB);
+
   if ((chatr & USER_OP) && (chatr & USER_DEOP))
   if ((chatr & USER_OP) && (chatr & USER_DEOP))
     chatr &= ~(USER_OP | USER_DEOP);
     chatr &= ~(USER_OP | USER_DEOP);
   if ((chatr & USER_AUTOOP) && (chatr & USER_DEOP))
   if ((chatr & USER_AUTOOP) && (chatr & USER_DEOP))

+ 1 - 1
src/flags.h

@@ -131,7 +131,7 @@ int build_flags(char *, struct flag_record *, struct flag_record *);
 int flagrec_eq(struct flag_record *, struct flag_record *);
 int flagrec_eq(struct flag_record *, struct flag_record *);
 int flagrec_ok(struct flag_record *, struct flag_record *);
 int flagrec_ok(struct flag_record *, struct flag_record *);
 flag_t sanity_check(flag_t, int);
 flag_t sanity_check(flag_t, int);
-flag_t chan_sanity_check(flag_t);
+flag_t chan_sanity_check(flag_t, int);
 char geticon(int);
 char geticon(int);
 int privchan(struct flag_record, struct chanset_t *, int);
 int privchan(struct flag_record, struct chanset_t *, int);
 int chk_op(struct flag_record, struct chanset_t *);
 int chk_op(struct flag_record, struct chanset_t *);