Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-02-24 03:07:13 UTC

Modified files:
     ChangeLog doc/example.conf include/client.h ircd/channel.c
     ircd/client.c ircd/ircd_lexer.l ircd/ircd_parser.y

Log message:

Define a privilege (off by default) that allows opers to use OPMODE
and CLEARMODE to set or remove Apass and Upass on channels.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.560 ircu2.10/ChangeLog:1.561
--- ircu2.10/ChangeLog:1.560    Wed Feb 23 14:20:11 2005
+++ ircu2.10/ChangeLog  Wed Feb 23 19:07:01 2005
@@ -1,5 +1,25 @@
 2005-02-23  Michael Poole <[EMAIL PROTECTED]>
 
+       * doc/example.conf: Explain apass_opmode privilege, pointing out
+       that, unlike previous privs, the default is OFF for global opers.
+
+       * include/client.h (PRIV_APASS_OPMODE): Define new privilege.
+
+       * ircd/channel.c (mode_parse_upass): Only prevent local opers
+       without the apass_opmode privilege from forcing a +U change.
+       (mode_parse_apass): Likewise, for +A.
+
+       * ircd/client.c (client_set_privs): Turn off PRIV_APASS_OPMODE in
+       the default privileges for global opers.
+
+       * ircd/ircd_lexer.l (apass_opmode): Recognize keyword.
+
+       * ircd/ircd_parser.y (TPRIV_APASS_OPMODE): New token.
+       (privtype): Fix typo for local_badchan privilege value.
+       Accept apass_opmode token.
+
+2005-02-23  Michael Poole <[EMAIL PROTECTED]>
+
        * doc/example.conf: Fix comment's description of "whox" privilege.
 
 2005-02-21  Michael Poole <[EMAIL PROTECTED]>
Index: ircu2.10/doc/example.conf
diff -u ircu2.10/doc/example.conf:1.45 ircu2.10/doc/example.conf:1.46
--- ircu2.10/doc/example.conf:1.45      Wed Feb 23 14:20:11 2005
+++ ircu2.10/doc/example.conf   Wed Feb 23 19:07:01 2005
@@ -218,10 +218,11 @@
  # opmode (can use /OPMODE)
  # badchan (can issue Gchans to other servers)
  # force_opmode (can use OPMODE/CLEARMODE on quarantined global channels)
+ # apass_opmode (can use OPMODE/CLEARMODE on +A and +U keys)
  #
  # For global opers (with propagate = yes or local = no), the default
- # is to grant all of the above privileges.  For local opers, the
- # default is to grant ONLY the following privileges:
+ # is to grant all of the above privileges EXCEPT apass_opmode.  For
+ # local opers, the default is to grant ONLY the following privileges:
  #  chan_limit, mode_lchan, show_invis, show_all_invis, local_kill,
  #  rehash, local_gline, local_jupe, local_opmode, whox, display,
  #  force_local_opmode
Index: ircu2.10/include/client.h
diff -u ircu2.10/include/client.h:1.44 ircu2.10/include/client.h:1.45
--- ircu2.10/include/client.h:1.44      Sun Jan 23 08:03:15 2005
+++ ircu2.10/include/client.h   Wed Feb 23 19:07:02 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Structures and functions for handling local clients.
- * @version $Id: client.h,v 1.44 2005/01/23 16:03:15 entrope Exp $
+ * @version $Id: client.h,v 1.45 2005/02/24 03:07:02 entrope Exp $
  */
 #ifndef INCLUDED_client_h
 #define INCLUDED_client_h
@@ -125,6 +125,7 @@
     PRIV_LIST_CHAN, /**< oper can list secret channels */
     PRIV_FORCE_OPMODE, /**< can hack modes on quarantined channels */
     PRIV_FORCE_LOCAL_OPMODE, /**< can hack modes on quarantined local channels 
*/
+    PRIV_APASS_OPMODE, /**< can hack modes +A/-A/+U/-U */
     PRIV_LAST_PRIV /**< number of privileges */
   };
 
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.117 ircu2.10/ircd/channel.c:1.118
--- ircu2.10/ircd/channel.c:1.117       Fri Feb 18 21:30:44 2005
+++ ircu2.10/ircd/channel.c     Wed Feb 23 19:07:02 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintanance
- * @version $Id: channel.c,v 1.117 2005/02/19 05:30:44 entrope Exp $
+ * @version $Id: channel.c,v 1.118 2005/02/24 03:07:02 entrope Exp $
  */
 #include "config.h"
 
@@ -2436,7 +2436,8 @@
   }
 
   /* If a non-service user is trying to force it, refuse. */
-  if (state->flags & MODE_PARSE_FORCE && !IsChannelService(state->sptr)) {
+  if (state->flags & MODE_PARSE_FORCE && MyUser(state->sptr)
+      && !HasPriv(state->sptr, PRIV_APASS_OPMODE)) {
     send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
                "Use /JOIN", state->chptr->chname, " <AdminPass>.");
     return;
@@ -2543,7 +2544,8 @@
   }
 
   /* If a non-service user is trying to force it, refuse. */
-  if (state->flags & MODE_PARSE_FORCE && !IsChannelService(state->sptr)) {
+  if (state->flags & MODE_PARSE_FORCE && MyUser(state->sptr)
+      && !HasPriv(state->sptr, PRIV_APASS_OPMODE)) {
     send_reply(state->sptr, ERR_NOTMANAGER, state->chptr->chname,
                "Use /JOIN", state->chptr->chname, " <AdminPass>.");
     return;
Index: ircu2.10/ircd/client.c
diff -u ircu2.10/ircd/client.c:1.29 ircu2.10/ircd/client.c:1.30
--- ircu2.10/ircd/client.c:1.29 Sat Dec 18 10:07:16 2004
+++ ircu2.10/ircd/client.c      Wed Feb 23 19:07:03 2005
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Implementation of functions for handling local clients.
- * @version $Id: client.c,v 1.29 2004/12/18 18:07:16 entrope Exp $
+ * @version $Id: client.c,v 1.30 2005/02/24 03:07:03 entrope Exp $
  */
 #include "config.h"
 
@@ -152,6 +152,8 @@
   if (!privs_defaults_set)
   {
     memset(&privs_global, -1, sizeof(privs_global));
+    FlagClr(&privs_global, PRIV_APASS_OPMODE);
+
     memset(&privs_local, 0, sizeof(privs_local));
     FlagSet(&privs_local, PRIV_CHAN_LIMIT);
     FlagSet(&privs_local, PRIV_MODE_LCHAN);
@@ -165,6 +167,7 @@
     FlagSet(&privs_local, PRIV_WHOX);
     FlagSet(&privs_local, PRIV_DISPLAY);
     FlagSet(&privs_local, PRIV_FORCE_LOCAL_OPMODE);
+
     privs_defaults_set = 1;
   }
 
Index: ircu2.10/ircd/ircd_lexer.l
diff -u ircu2.10/ircd/ircd_lexer.l:1.16 ircu2.10/ircd/ircd_lexer.l:1.17
--- ircu2.10/ircd/ircd_lexer.l:1.16     Sat Jan 15 07:23:03 2005
+++ ircu2.10/ircd/ircd_lexer.l  Wed Feb 23 19:07:03 2005
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_lexer.l,v 1.16 2005/01/15 15:23:03 entrope Exp $
+ * $Id: ircd_lexer.l,v 1.17 2005/02/24 03:07:03 entrope Exp $
  */
 
 %{
@@ -100,6 +100,7 @@
   TOKEN(USERMODE),
 #undef TOKEN
   { "administrator", ADMIN },
+  { "apass_opmode", TPRIV_APASS_OPMODE },
   { "b", BYTES },
   { "badchan", TPRIV_BADCHAN },
   { "chan_limit", TPRIV_CHAN_LIMIT },
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.39 ircu2.10/ircd/ircd_parser.y:1.40
--- ircu2.10/ircd/ircd_parser.y:1.39    Sat Feb 19 14:11:39 2005
+++ ircu2.10/ircd/ircd_parser.y Wed Feb 23 19:07:03 2005
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_parser.y,v 1.39 2005/02/19 22:11:39 isomer Exp $
+ * $Id: ircd_parser.y,v 1.40 2005/02/24 03:07:03 entrope Exp $
  */
 %{
 
@@ -163,7 +163,7 @@
 %token TPRIV_LOCAL_OPMODE TPRIV_OPMODE TPRIV_SET TPRIV_WHOX TPRIV_BADCHAN
 %token TPRIV_SEE_CHAN TPRIV_SHOW_INVIS TPRIV_SHOW_ALL_INVIS TPRIV_PROPAGATE
 %token TPRIV_UNLIMIT_QUERY TPRIV_DISPLAY TPRIV_SEE_OPERS TPRIV_WIDE_GLINE
-%token TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE
+%token TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE TPRIV_APASS_OPMODE
 /* and some types... */
 %type <num> sizespec
 %type <num> timespec timefactor factoredtimes factoredtime
@@ -578,7 +578,7 @@
           TPRIV_SET { $$ = PRIV_SET; } |
           TPRIV_WHOX { $$ = PRIV_WHOX; } |
           TPRIV_BADCHAN { $$ = PRIV_BADCHAN; } |
-          TPRIV_LOCAL_BADCHAN { $$ = TPRIV_LOCAL_BADCHAN; } |
+          TPRIV_LOCAL_BADCHAN { $$ = PRIV_LOCAL_BADCHAN; } |
           TPRIV_SEE_CHAN { $$ = PRIV_SEE_CHAN; } |
           TPRIV_SHOW_INVIS { $$ = PRIV_SHOW_INVIS; } |
           TPRIV_SHOW_ALL_INVIS { $$ = PRIV_SHOW_ALL_INVIS; } |
@@ -589,7 +589,8 @@
           TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; } |
           LOCAL { $$ = PRIV_PROPAGATE; invert = 1; } |
           TPRIV_FORCE_OPMODE { $$ = PRIV_FORCE_OPMODE; } |
-          TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; };
+          TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; } |
+          TPRIV_APASS_OPMODE { $$ = PRIV_APASS_OPMODE; } ;
 
 yesorno: YES { $$ = 1; } | NO { $$ = 0; };
 
----------------------- End of diff -----------------------

Reply via email to