Get rid of CONF_LOCOP; use PRIV_PROPAGATE instead.
authorMichael Poole <mdpoole@troilus.org>
Sun, 16 May 2004 13:56:06 +0000 (13:56 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sun, 16 May 2004 13:56:06 +0000 (13:56 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1067 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/s_conf.h
ircd/ircd_parser.y
ircd/m_oper.c
ircd/s_conf.c
ircd/s_stats.c
ircd/s_user.c

index f2194eec25414e947ee6d2f8375aef64969adef4..5a48eb779691de015ee9e3cfea54b29517c86d71 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2004-05-16  Michael Poole <mdpoole@troius.org>
+
+       Get rid of CONF_LOCOP; use PRIV_PROPAGATE instead.
+
+       * ircd/ircd_parser.y (invert): New variable.
+       (operlocal): Remove production.
+       (operpriv): Use "invert" variable.
+       (privtype): Add LOCAL alternative production.
+
+       * ircd/m_oper.c (m_oper): Remove references to CONF_LOCOP; replace
+       with CONF_OPERATOR or PRIV_PROPAGATE checks, as appropriate.
+
+       * ircd/s_conf.c (AuthorizationCheckResult, find_conf_exact):
+       Likewise.
+
+       * ircd/s_stats.c (report_array, statsinfo): Likewise.
+
+       * ircd/s_user.c (set_user_mode): Likewise.
+
 2004-05-15  Michael Poole <mdpoole@troilus.org>
 
        * patches/diffs/astralnet.diff, patches/diffs/nocfv.diff: Remove
index ff9a007a4a522db2b1570abd4cddef62fb19dbc7..7e37d4cb06752773db8191ab9c035b04640a0f49 100644 (file)
@@ -37,14 +37,12 @@ struct Message;
 #define CONF_MATCH              0x40000000
 #define CONF_CLIENT             0x0002
 #define CONF_SERVER             0x0004
-#define CONF_LOCOP              0x0010
 #define CONF_OPERATOR           0x0020
 #define CONF_LEAF               0x1000
 #define CONF_HUB                0x4000
 #define CONF_UWORLD             0x8000
 
-#define CONF_OPS                (CONF_OPERATOR | CONF_LOCOP)
-#define CONF_CLIENT_MASK        (CONF_CLIENT | CONF_OPS | CONF_SERVER)
+#define CONF_CLIENT_MASK        (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER)
 
 #define IsIllegal(x)    ((x)->status & CONF_ILLEGAL)
 
index 4aa34881009607999cce85f973ea2663bb0d31b2..8233077d64eb6fc7a584d85fb3e24166daf99493 100644 (file)
@@ -69,7 +69,7 @@
 
   int yylex(void);
   /* Now all the globals we need :/... */
-  int tping, tconn, maxlinks, sendq, port;
+  int tping, tconn, maxlinks, sendq, port, invert;
   int stringno;
   char *name, *pass, *host;
   char *stringlist[MAX_STRINGS];
@@ -521,7 +521,7 @@ operblock: OPER
   }
 };
 operitems: operitem | operitems operitem;
-operitem: opername | operpass | operlocal | operhost | operclass | operpriv | error;
+operitem: opername | operpass | operhost | operclass | operpriv | error;
 
 opername: NAME '=' QSTRING ';'
 {
@@ -535,17 +535,6 @@ operpass: PASS '=' QSTRING ';'
   DupString(aconf->passwd, yylval.text);
 };
 
-operlocal: LOCAL '=' YES ';'
-{
-  /* XXX it would be good to get rid of local operators and add same
-   * permission values here. But for now, I am just going with local 
-   * opers... */
-  aconf->status = CONF_LOCOP;
-} | LOCAL '=' NO ';'
-{
-  aconf->status = CONF_OPERATOR;
-};
-
 operhost: HOST '=' QSTRING ';'
 {
  MyFree(aconf->host);
@@ -567,16 +556,12 @@ operclass: CLASS '=' QSTRING ';'
 
 operpriv: privtype '=' yesorno ';'
 {
-  if ($3 == 1)
-  {
-    PrivSet(&aconf->privs_dirty, $1);
+  PrivSet(&aconf->privs_dirty, $1);
+  if (($3 == 1) ^ invert)
     PrivSet(&aconf->privs, $1);
-  }
   else
-  {
-    PrivSet(&aconf->privs_dirty, $1);
     PrivClr(&aconf->privs, $1);
-  }
+  invert = 0;
 };
 
 privtype: TPRIV_CHAN_LIMIT { $$ = PRIV_CHAN_LIMIT; } |
@@ -605,7 +590,8 @@ privtype: TPRIV_CHAN_LIMIT { $$ = PRIV_CHAN_LIMIT; } |
           TPRIV_UNLIMIT_QUERY { $$ = PRIV_UNLIMIT_QUERY; } |
           TPRIV_DISPLAY { $$ = PRIV_DISPLAY; } |
           TPRIV_SEE_OPERS { $$ = PRIV_SEE_OPERS; } |
-          TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; };
+          TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; } |
+          LOCAL { $$ = PRIV_PROPAGATE; invert = 1; };
 
 yesorno: YES { $$ = 1; } | NO { $$ = 0; };
 
index d334d68e41e6ba6cb31ced72ed19cf3233b4e95a..d23e2f2205b2411f3df4a7ed09d9938804c56b26 100644 (file)
@@ -138,10 +138,10 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (EmptyString(name) || EmptyString(password))
     return need_more_params(sptr, "OPER");
 
-  aconf = find_conf_exact(name, cli_username(sptr), cli_sockhost(sptr), CONF_OPS);
+  aconf = find_conf_exact(name, cli_username(sptr), cli_sockhost(sptr), CONF_OPERATOR);
   if (!aconf) 
     aconf = find_conf_exact(name, cli_username(sptr),
-                            ircd_ntoa((const char*) &(cli_ip(cptr))), CONF_OPS);
+                            ircd_ntoa((const char*) &(cli_ip(cptr))), CONF_OPERATOR);
 
   if (!aconf || IsIllegal(aconf))
   {
@@ -150,7 +150,7 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                         parv[0], cli_user(sptr)->username, cli_sockhost(sptr));
     return 0;
   }
-  assert(0 != (aconf->status & CONF_OPS));
+  assert(0 != (aconf->status & CONF_OPERATOR));
 
   if (oper_password_match(password, aconf->passwd))
   {
@@ -163,7 +163,7 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                           cli_sockhost(sptr));
       return 0;
     }
-    if (CONF_LOCOP == aconf->status) {
+    if (!PrivHas(&aconf->privs, PRIV_PROPAGATE)) {
       ClearOper(sptr);
       SetLocOp(sptr);
     }
index 830549dbd14b741cc5b674c6995617b816ee15a3..714622f1ebf8f612b05449bf939065ec585f5187 100644 (file)
@@ -452,7 +452,7 @@ enum AuthorizationCheckResult attach_conf(struct Client *cptr, struct ConfItem *
     return ACR_ALREADY_AUTHORIZED;
   if (IsIllegal(aconf))
     return ACR_NO_AUTHORIZATION;
-  if ((aconf->status & (CONF_LOCOP | CONF_OPERATOR | CONF_CLIENT)) &&
+  if ((aconf->status & (CONF_OPERATOR | CONF_CLIENT)) &&
       ConfLinks(aconf) >= ConfMaxLinks(aconf) && ConfMaxLinks(aconf) > 0)
     return ACR_TOO_MANY_IN_CLASS;  /* Use this for printing error message */
   lp = make_link();
@@ -550,7 +550,7 @@ struct ConfItem* find_conf_exact(const char* name, const char* user,
      */
     if (match(tmp->host, userhost))
       continue;
-    if (tmp->status & (CONF_OPERATOR | CONF_LOCOP)) {
+    if (tmp->status & CONF_OPERATOR) {
       if (tmp->clients < MaxLinks(tmp->conn_class))
         return tmp;
       else
index 34eb34a16e23e442784d8a9f4bfb5b1224e1dc79..7de3d5df4885236d69c21d7b904b98cbab891f02 100644 (file)
@@ -74,7 +74,6 @@ static unsigned int report_array[17][3] = {
   {CONF_LEAF, RPL_STATSLLINE, 'L'},
   {CONF_OPERATOR, RPL_STATSOLINE, 'O'},
   {CONF_HUB, RPL_STATSHLINE, 'H'},
-  {CONF_LOCOP, RPL_STATSOLINE, 'o'},
   {CONF_UWORLD, RPL_STATSULINE, 'U'},
   {0, 0}
 };
@@ -460,7 +459,7 @@ struct StatDesc statsinfo[] = {
     stats_commands, 0,
     "Message usage information." },
   { 'o', STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_o,
-    stats_configured_links, CONF_OPS,
+    stats_configured_links, CONF_OPERATOR,
     "Operator information." },
   { 'p', (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_p,
     show_ports, 0,
index c2ff89a2bdb3b7276d291be039021429db2af378..34e341a7606718b7871b183f9bd34b62e1226522 100644 (file)
@@ -1312,7 +1312,7 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
   {
     if ((FlagHas(&setflags, FLAG_OPER) || FlagHas(&setflags, FLAG_LOCOP)) &&
         !IsAnOper(sptr))
-      det_confs_butmask(sptr, CONF_CLIENT & ~CONF_OPS);
+      det_confs_butmask(sptr, CONF_CLIENT & ~CONF_OPERATOR);
 
     if (SendServNotice(sptr))
     {