]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/newconf.c
Backed out changeset 7f24e5f3fb86
[irc/rqf/shadowircd.git] / src / newconf.c
index 651361aa89e47aad4a20d576cec2bf4c101f6c18..b8fcee13b1ca02f92366ec716a6595de617b4b8e 100644 (file)
@@ -471,7 +471,7 @@ conf_set_privset_privs(void *data)
                        char *privs_old = privs;
 
                        privs = rb_malloc(strlen(privs_old) + 1 + strlen(args->v.string) + 1);
-                       strcpy(privs_old, privs);
+                       strcpy(privs, privs_old);
                        strcat(privs, " ");
                        strcat(privs, args->v.string);
 
@@ -487,13 +487,9 @@ conf_set_privset_privs(void *data)
 
                        if (!set)
                        {
-                               conf_report_error("Warning -- unknown parent privilege set %s for %s; ignored.", yy_privset_extends, conf_cur_block_name);
+                               conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends, conf_cur_block_name);
 
-                               rb_free(yy_privset_extends);
-                               rb_free(privs);
-
-                               yy_privset_extends = NULL;
-                               return;
+                               set = privilegeset_get("default");
                        }
 
                        privilegeset_extend(set, conf_cur_block_name != NULL ? conf_cur_block_name : "<unknown>", privs, 0);
@@ -581,6 +577,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 +626,15 @@ 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);
+
+       if (!yy_oper->privset)
+               yy_oper->privset = privilegeset_get("default");
+}
+
 static void
 conf_set_oper_user(void *data)
 {
@@ -2027,6 +2033,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 },