Load in new bans from bandb on startup.

This commit is contained in:
William Pitcock 2010-01-07 18:06:15 -06:00
parent d4c273075e
commit 80c9ac516e
2 changed files with 4 additions and 38 deletions

View file

@ -671,7 +671,6 @@ main(int argc, char *argv[])
if (testing_conf)
fprintf(stderr, "\nBeginning config test\n");
read_conf_files(YES); /* cold start init conf files */
rehash_bans(0);
#ifndef STATIC_MODULES
mod_add_path(MODULE_DIR);
@ -681,6 +680,8 @@ main(int argc, char *argv[])
init_bandb();
init_ssld();
rehash_bans(0);
initialize_server_capabs(); /* Set up default_server_capabs */
initialize_global_set_options();

View 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();
}
/*