]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Initial work on getting privsets working.
authorWilliam Pitcock <redacted>
Sun, 17 Aug 2008 12:40:27 +0000 (07:40 -0500)
committerWilliam Pitcock <redacted>
Sun, 17 Aug 2008 12:40:27 +0000 (07:40 -0500)
src/newconf.c
src/s_newconf.c
src/s_user.c

index 651361aa89e47aad4a20d576cec2bf4c101f6c18..e6a1d565259adef6d21c0c0bed91cdd93528733f 100644 (file)
@@ -581,6 +581,7 @@ conf_end_oper(struct TopConf *tc)
                yy_tmpoper->flags = yy_oper->flags;
                yy_tmpoper->umodes = yy_oper->umodes;
                yy_tmpoper->snomask = yy_oper->snomask;
+               yy_tmpoper->privset = yy_oper->privset;
 
 #ifdef HAVE_LIBCRYPTO
                if(yy_oper->rsa_pubkey_file)
@@ -629,6 +630,12 @@ conf_set_oper_flags(void *data)
        set_modes_from_table(&yy_oper->flags, "flag", oper_table, args);
 }
 
+static void
+conf_set_oper_privset(void *data)
+{
+       yy_oper->privset = privilegeset_get((char *) data);
+}
+
 static void
 conf_set_oper_user(void *data)
 {
@@ -2027,6 +2034,7 @@ static struct ConfEntry conf_operator_table[] =
        { "rsa_public_key_file",  CF_QSTRING, conf_set_oper_rsa_public_key_file, 0, NULL },
        { "flags",      CF_STRING | CF_FLIST, conf_set_oper_flags,      0, NULL },
        { "umodes",     CF_STRING | CF_FLIST, conf_set_oper_umodes,     0, NULL },
+       { "privset",    CF_QSTRING, conf_set_oper_privset,      0, NULL },
        { "snomask",    CF_QSTRING, conf_set_oper_snomask,      0, NULL },
        { "user",       CF_QSTRING, conf_set_oper_user,         0, NULL },
        { "password",   CF_QSTRING, conf_set_oper_password,     0, NULL },
index af81101009e6d7167807fe6577b1e41182469d31..93f5896849a6dee8f27ecc303c8b01f81f2275b6 100644 (file)
@@ -318,55 +318,6 @@ find_oper_conf(const char *username, const char *host, const char *locip, const
        return NULL;
 }
 
-struct oper_flags
-{
-       int flag;
-       const char *name;
-};
-static struct oper_flags oper_flagtable[] =
-{
-       { OPER_KLINE,           "kline"        },
-       { OPER_XLINE,           "xline"        },
-       { OPER_RESV,            "resv"         },
-       { OPER_GLOBKILL,        "global_kill"  },
-       { OPER_LOCKILL,         "local_kill"   },
-       { OPER_REMOTE,          "remote"       },
-       { OPER_UNKLINE,         "unkline"      },
-       { OPER_REHASH,          "rehash"       },
-       { OPER_DIE,             "die"          },
-       { OPER_ADMIN,           "admin"        },
-        { OPER_HADMIN,          "hidden_admin" },
-       { OPER_NICKS,           "nick_changes" },
-       { OPER_OPERWALL,        "operwall"     },
-       { OPER_SPY,             "spy"          },
-       { OPER_INVIS,           "hidden_oper"  },
-       { OPER_REMOTEBAN,       "remoteban"    },
-       { OPER_MASSNOTICE,      "mass_notice"  },
-       { 0,                    NULL }
-};
-
-const char *
-get_oper_privs(int flags)
-{
-       static char buf[BUFSIZE];
-       char *p;
-       int i;
-
-       p = buf;
-       *p = '\0';
-
-       for(i = 0; oper_flagtable[i].flag; i++)
-               if (flags & oper_flagtable[i].flag)
-               {
-                       if(*buf != '\0')
-                               rb_strlcat(buf, ", ", sizeof(buf));
-
-                       rb_strlcat(buf, oper_flagtable[i].name, sizeof(buf));
-               }
-
-       return buf;
-}
-
 struct server_conf *
 make_server_conf(void)
 {
index 57f3432e12950987f51f0f84feecf7cb20e38f18..fa6ce1bcb2a6a46e47ddd8f387ff6645d0d4d6e3 100644 (file)
@@ -1276,7 +1276,8 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
        sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
                   construct_snobuf(source_p->snomask));
        sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name);
-       sendto_one_notice(source_p, ":*** Oper privs are %s", get_oper_privs(oper_p->flags));
+       sendto_one_notice(source_p, ":*** Oper privilege set is %s", oper_p->privset->name);
+       sendto_one_notice(source_p, ":*** Oper privs are %s", oper_p->privset->privs);
        send_oper_motd(source_p);
 
        return (1);