From 4a7ad45e99247ac6a4910660d1fa11532a19b6b3 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Sun, 16 May 2004 13:56:06 +0000 Subject: [PATCH] Get rid of CONF_LOCOP; use PRIV_PROPAGATE instead. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1067 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 19 +++++++++++++++++++ include/s_conf.h | 4 +--- ircd/ircd_parser.y | 28 +++++++--------------------- ircd/m_oper.c | 8 ++++---- ircd/s_conf.c | 4 ++-- ircd/s_stats.c | 3 +-- ircd/s_user.c | 2 +- 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2194ee..5a48eb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2004-05-16 Michael Poole + + 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 * patches/diffs/astralnet.diff, patches/diffs/nocfv.diff: Remove diff --git a/include/s_conf.h b/include/s_conf.h index ff9a007..7e37d4c 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -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) diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index 4aa3488..8233077 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -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; }; diff --git a/ircd/m_oper.c b/ircd/m_oper.c index d334d68..d23e2f2 100644 --- a/ircd/m_oper.c +++ b/ircd/m_oper.c @@ -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); } diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 830549d..714622f 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -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 diff --git a/ircd/s_stats.c b/ircd/s_stats.c index 34eb34a..7de3d5d 100644 --- a/ircd/s_stats.c +++ b/ircd/s_stats.c @@ -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, diff --git a/ircd/s_user.c b/ircd/s_user.c index c2ff89a..34e341a 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -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)) { -- 2.20.1