]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Warn about auth blocks after a *@* auth and duplicate auth blocks.
authorJilles Tjoelker <redacted>
Sat, 31 Jan 2009 17:42:03 +0000 (18:42 +0100)
committerJilles Tjoelker <redacted>
Sat, 31 Jan 2009 17:42:03 +0000 (18:42 +0100)
src/newconf.c

index ce954c48efe5fae5120a8c3d4445377415066af3..80c59e8e60e72159fff87bf0970841fdf26c0186 100644 (file)
@@ -910,7 +910,13 @@ 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 (find_exact_conf_by_address("*", CONF_CLIENT, "*"))
+               conf_report_error("Ignoring redundant auth block (after *@*)");
+       else if (find_exact_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user))
+               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)
        {
@@ -936,7 +942,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);
        }