]> jfr.im git - solanum.git/blobdiff - src/s_conf.c
Do not try to free the alias dict if it does not exist.
[solanum.git] / src / s_conf.c
index 7acb57343ef299e440ce38028e6b6ab948bf6cfd..b5004bcba1dc56052ffe78e49d59fb22dedc2003 100644 (file)
@@ -49,6 +49,7 @@
 #include "blacklist.h"
 #include "privilege.h"
 #include "sslproc.h"
+#include "bandbi.h"
 
 struct config_server_hide ConfigServerHide;
 
@@ -654,43 +655,7 @@ static struct banconf_entry
 void
 rehash_bans(int sig)
 {
-       FILE *file;
-       char buf[MAXPATHLEN];
-       int i;
-
-       if(sig != 0)
-               sendto_realops_snomask(SNO_GENERAL, L_ALL,
-                               "Got signal SIGUSR2, reloading ban confs");
-
-       clear_out_address_conf_bans();
-       clear_s_newconf_bans();
-
-       for(i = 0; banconfs[i].filename; i++)
-       {
-               if(banconfs[i].perm)
-                       snprintf(buf, sizeof(buf), "%s.perm", *banconfs[i].filename);
-               else
-                       snprintf(buf, sizeof(buf), "%s", *banconfs[i].filename);
-
-               if((file = fopen(buf, "r")) == NULL)
-               {
-                       if(banconfs[i].perm)
-                               continue;
-
-                       ilog(L_MAIN, "Failed reading ban file %s",
-                               *banconfs[i].filename);
-                       sendto_realops_snomask(SNO_GENERAL, L_ALL,
-                                       "Can't open %s file bans could be missing!",
-                                       *banconfs[i].filename);
-               }
-               else
-               {
-                       (banconfs[i].func)(file);
-                       fclose(file);
-               }
-       }
-
-       check_banned_lines();
+       bandb_rehash_bans();
 }
 
 /*
@@ -834,6 +799,9 @@ set_default_conf(void)
        ConfigFileEntry.throttle_duration = 60;
 
        ServerInfo.default_max_clients = MAXCONNECTIONS;
+
+       if (!alias_dict)
+               alias_dict = irc_dictionary_create(strcasecmp);
 }
 
 #undef YES
@@ -1253,8 +1221,11 @@ clear_out_old_conf(void)
        }
 
        /* remove any aliases... -- nenolod */
-       irc_dictionary_destroy(alias_dict, free_alias_cb, NULL);
-       alias_dict = NULL;
+       if (alias_dict != NULL)
+       {
+               irc_dictionary_destroy(alias_dict, free_alias_cb, NULL);
+               alias_dict = NULL;
+       }
 
        destroy_blacklists();