From 00ed3759bb4fddfda3548fa632caff57b24db277 Mon Sep 17 00:00:00 2001 From: stskeeps Date: Sun, 17 Jun 2001 17:02:09 +0000 Subject: [PATCH] +- Fixed some scan-socks and blackhole fuckups --- Changes | 1 + src/modules/blackhole.c | 20 ++++++++++++++++---- src/modules/scan_socks.c | 8 +++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 1bc8cba82..06684b423 100644 --- a/Changes +++ b/Changes @@ -575,3 +575,4 @@ seen. gmtime warning still there - Fixed a codemastr screwup in quarantine code - Removed the old SOCKS check code. - Fixed a quarantine bug +- Fixed some scan-socks and blackhole fuckups \ No newline at end of file diff --git a/src/modules/blackhole.c b/src/modules/blackhole.c index 8cf4aaf15..fe29beef2 100644 --- a/src/modules/blackhole.c +++ b/src/modules/blackhole.c @@ -103,8 +103,18 @@ void blackhole_load(void) if (!blackhole_conf.ip || !blackhole_conf.port) { config_error("set::blackhole: missing ip/port mask"); + return 0; } + if (blackhole_stop == 1) + { + sendto_realops("blackhole is already running, restarting module.."); + blackhole_stop = 2; + while (blackhole_stop == 2) {} + } + blackhole_stop = 0; + IRCCreateThread(thread, thread_attr, blackhole, NULL); + while (blackhole_stop == 1) {} } @@ -116,8 +126,8 @@ DLLFUNC void mod_unload(void) void blackhole_unload(void) #endif { - blackhole_stop = 1; - while (blackhole_stop == 1) {} + blackhole_stop = 2; + while (blackhole_stop == 2) {} del_Hook(HOOKTYPE_CONFIG_UNKNOWN, h_config_set_blackhole); } @@ -202,13 +212,15 @@ DLLFUNC void blackhole(void *p) listen(blackholefd, LISTEN_SIZE); - - while (!blackhole_stop) + /* We hereby indicate that we are set up*/ + blackhole_stop = 1; + while (blackhole_stop != 2) { callerfd = accept(blackholefd, NULL, NULL); CLOSE_SOCK(callerfd); } end: + CLOSE_SOCK(blackholefd) blackhole_stop = 0; IRCExitThread(NULL); } \ No newline at end of file diff --git a/src/modules/scan_socks.c b/src/modules/scan_socks.c index 41f57e9b8..9966b4156 100644 --- a/src/modules/scan_socks.c +++ b/src/modules/scan_socks.c @@ -96,11 +96,17 @@ void scan_socks_init(void) if (!xHSlock || !xVSlock || !xVS_add) { module_buffer = NULL; - config_error("scan_socks: i depend on scan.so"); + config_error("scan_socks: i depend on scan.so being loaded"); return; } blackhole_conf = (ConfigItem_blackhole *) module_sym("blackhole_conf"); + if (!blackhole_conf) + { + module_buffer = NULL; + config_error("scan_socks: i depend on blackhole.so being loaded"); + return; + } module_buffer = &scan_socks_info; /*