]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/newconf.c
target change: Overwrite the least recently used target with a new one.
[irc/rqf/shadowircd.git] / src / newconf.c
index e6a1d565259adef6d21c0c0bed91cdd93528733f..3cf15c6d5ba035e6f2de6048dcffb70362425700 100644 (file)
@@ -263,7 +263,7 @@ conf_set_modules_module(void *data)
 #ifndef STATIC_MODULES
        char *m_bn;
 
-       m_bn = irc_basename((char *) data);
+       m_bn = rb_basename((char *) data);
 
        if(findmodule_byname(m_bn) != -1)
                return;
@@ -308,23 +308,7 @@ static struct mode_table umode_table[] = {
 
 static struct mode_table oper_table[] = {
        {"encrypted",           OPER_ENCRYPTED          },
-       {"local_kill",          OPER_LOCKILL            },
-       {"global_kill",         OPER_GLOBKILL|OPER_LOCKILL      },
-       {"remote",              OPER_REMOTE             },
-       {"kline",               OPER_KLINE              },
-       {"unkline",             OPER_UNKLINE            },
-       {"nick_changes",        OPER_NICKS              },
-       {"rehash",              OPER_REHASH             },
-       {"die",                 OPER_DIE                },
-       {"admin",               OPER_ADMIN              },
-       {"hidden_admin",        OPER_HADMIN             },
-       {"xline",               OPER_XLINE              },
-       {"resv",                OPER_RESV               },
-       {"operwall",            OPER_OPERWALL           },
-       {"oper_spy",            OPER_SPY                },
-       {"hidden_oper",         OPER_INVIS              },
-       {"remoteban",           OPER_REMOTEBAN          },
-       {"mass_notice",         OPER_MASSNOTICE         },
+       {"need_ssl",            OPER_NEEDSSL            },
        {NULL, 0}
 };
 
@@ -342,6 +326,7 @@ static struct mode_table auth_table[] = {
        {"no_tilde",            CONF_FLAGS_NO_TILDE     },
        {"need_ident",          CONF_FLAGS_NEED_IDENTD  },
        {"have_ident",          CONF_FLAGS_NEED_IDENTD  },
+       {"need_ssl",            CONF_FLAGS_NEED_SSL     },
        {"need_sasl",           CONF_FLAGS_NEED_SASL    },
        {NULL, 0}
 };
@@ -471,7 +456,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 +472,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);
@@ -527,7 +508,7 @@ conf_begin_oper(struct TopConf *tc)
        }
 
        yy_oper = make_oper_conf();
-       yy_oper->flags |= OPER_ENCRYPTED|OPER_RESV|OPER_OPERWALL|OPER_REMOTEBAN|OPER_MASSNOTICE;
+       yy_oper->flags |= OPER_ENCRYPTED;
 
        return 0;
 }
@@ -564,6 +545,10 @@ conf_end_oper(struct TopConf *tc)
                return 0;
        }
 
+
+       if (!yy_oper->privset)
+               yy_oper->privset = privilegeset_get("default");
+
        /* now, yy_oper_list contains a stack of oper_conf's with just user
         * and host in, yy_oper contains the rest of the information which
         * we need to copy into each element in yy_oper_list
@@ -738,21 +723,33 @@ conf_set_class_ping_time(void *data)
 }
 
 static void
-conf_set_class_cidr_bitlen(void *data)
+conf_set_class_cidr_ipv4_bitlen(void *data)
 {
+       unsigned int maxsize = 32;
+       if(*(unsigned int *) data > maxsize)
+               conf_report_error
+                       ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
+                        *(unsigned int *) data, maxsize);
+       else
+               yy_class->cidr_ipv4_bitlen = *(unsigned int *) data;
+
+}
+
 #ifdef RB_IPV6
+static void
+conf_set_class_cidr_ipv6_bitlen(void *data)
+{
        unsigned int maxsize = 128;
-#else
-       unsigned int maxsize = 32;
-#endif
        if(*(unsigned int *) data > maxsize)
                conf_report_error
-                       ("class::cidr_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
+                       ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.",
                         *(unsigned int *) data, maxsize);
        else
-               yy_class->cidr_bitlen = *(unsigned int *) data;
+               yy_class->cidr_ipv6_bitlen = *(unsigned int *) data;
 
 }
+#endif
+
 static void
 conf_set_class_number_per_cidr(void *data)
 {
@@ -895,7 +892,7 @@ conf_begin_auth(struct TopConf *tc)
 static int
 conf_end_auth(struct TopConf *tc)
 {
-       struct ConfItem *yy_tmp;
+       struct ConfItem *yy_tmp, *found_conf;
        rb_dlink_node *ptr;
        rb_dlink_node *next_ptr;
 
@@ -913,7 +910,15 @@ conf_end_auth(struct TopConf *tc)
        collapse(yy_aconf->user);
        collapse(yy_aconf->host);
        conf_add_class_to_conf(yy_aconf);
-       add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf->spasswd, yy_aconf);
+       if ((found_conf = find_exact_conf_by_address("*", CONF_CLIENT, "*")) && found_conf->spasswd == NULL)
+               conf_report_error("Ignoring redundant auth block (after *@*)");
+       else if ((found_conf = find_exact_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user)) &&
+                       (!found_conf->spasswd || (yy_aconf->spasswd &&
+                           0 == irccmp(found_conf->spasswd, yy_aconf->spasswd))))
+               conf_report_error("Ignoring duplicate auth block for %s@%s",
+                               yy_aconf->user, yy_aconf->host);
+       else
+               add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf->spasswd, yy_aconf);
 
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head)
        {
@@ -939,7 +944,13 @@ conf_end_auth(struct TopConf *tc)
 
                conf_add_class_to_conf(yy_tmp);
 
-               add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp->spasswd, yy_tmp);
+               if (find_exact_conf_by_address("*", CONF_CLIENT, "*"))
+                       conf_report_error("Ignoring redundant auth block (after *@*)");
+               else if (find_exact_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user))
+                       conf_report_error("Ignoring duplicate auth block for %s@%s",
+                                       yy_tmp->user, yy_tmp->host);
+               else
+                       add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp->spasswd, yy_tmp);
                rb_dlinkDestroy(ptr, &yy_aconf_list);
        }
 
@@ -1246,13 +1257,6 @@ conf_end_connect(struct TopConf *tc)
                yy_server->flags &= ~SERVER_COMPRESSED;
        }
 #endif
-       if(ServerConfCompressed(yy_server) && ServerConfSSL(yy_server))
-       {
-               conf_report_error("Ignoring compressed for connect block %s -- "
-                                      "ssl and compressed are mutually exclusive (OpenSSL does its own compression)", 
-                                      yy_server->name);
-               yy_server->flags &= ~SERVER_COMPRESSED;
-       }
 
        add_server_conf(yy_server);
        rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list);
@@ -1720,9 +1724,6 @@ conf_end_alias(struct TopConf *tc)
                return -1;
        }
 
-       if (!alias_dict)
-               alias_dict = irc_dictionary_create(strcasecmp);
-
        irc_dictionary_add(alias_dict, yy_alias->name, yy_alias);
 
        return 0;
@@ -2051,7 +2052,10 @@ static struct ConfEntry conf_privset_table[] =
 static struct ConfEntry conf_class_table[] =
 {
        { "ping_time",          CF_TIME, conf_set_class_ping_time,              0, NULL },
-       { "cidr_bitlen",        CF_INT,  conf_set_class_cidr_bitlen,            0, NULL },
+       { "cidr_ipv4_bitlen",   CF_INT,  conf_set_class_cidr_ipv4_bitlen,               0, NULL },
+#ifdef RB_IPV6
+       { "cidr_ipv6_bitlen",   CF_INT,  conf_set_class_cidr_ipv6_bitlen,               0, NULL },
+#endif
        { "number_per_cidr",    CF_INT,  conf_set_class_number_per_cidr,        0, NULL },
        { "number_per_ip",      CF_INT,  conf_set_class_number_per_ip,          0, NULL },
        { "number_per_ip_global", CF_INT,conf_set_class_number_per_ip_global,   0, NULL },
@@ -2180,10 +2184,12 @@ static struct ConfEntry conf_channel_table[] =
        { "max_chans_per_user", CF_INT,   NULL, 0, &ConfigChannel.max_chans_per_user    },
        { "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split    },
        { "no_join_on_split",   CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split      },
+       { "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels },
        { "use_except",         CF_YESNO, NULL, 0, &ConfigChannel.use_except            },
        { "use_invex",          CF_YESNO, NULL, 0, &ConfigChannel.use_invex             },
        { "use_knock",          CF_YESNO, NULL, 0, &ConfigChannel.use_knock             },
        { "use_forward",        CF_YESNO, NULL, 0, &ConfigChannel.use_forward           },
+       { "resv_forcepart",     CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart        },
        { "\0",                 0,        NULL, 0, NULL }
 };