# HG changeset patch # User carl # Date 1083310364 25200 # Node ID 041ea016b684292cdb23d4a59e2a5ba427813500 # Parent b6a4b72bb96e6df9b7fc7f996099577f3e7c7193 add scanning for bare hostnames diff -r b6a4b72bb96e -r 041ea016b684 src/dnsbl.cpp --- a/src/dnsbl.cpp Thu Apr 29 22:05:03 2004 -0700 +++ b/src/dnsbl.cpp Fri Apr 30 00:32:44 2004 -0700 @@ -150,6 +150,7 @@ } static bool debug_syslog = false; +static bool loader_run = true; // used to stop the config loader thread static string_set all_strings; // owns all the strings, only modified by the config loader thread static CONFIG * config = NULL; // protected by the config_mutex @@ -973,8 +974,9 @@ static void* config_loader(void *arg) { typedef set configp_set; configp_set old_configs; - while (true) { + while (loader_run) { sleep(180); // look for modifications every 3 minutes + if (!loader_run) break; CONFIG &dc = *config; time_t then = dc.load_time; struct stat st; @@ -1004,6 +1006,7 @@ else i++; } } + return NULL; } @@ -1118,6 +1121,13 @@ fclose(f); } - return smfi_main(); + time_t starting = time(NULL); + int rc = smfi_main(); + if (time(NULL) > starting+5*60) { + my_syslog("trying to restart after smfi_main()"); + loader_run = false; // eventually the config loader thread will terminate + execvp(argv[0], argv); + } + exit((rc == MI_SUCCESS) ? 0 : EX_UNAVAILABLE); } diff -r b6a4b72bb96e -r 041ea016b684 src/scanner.cpp --- a/src/scanner.cpp Thu Apr 29 22:05:03 2004 -0700 +++ b/src/scanner.cpp Fri Apr 30 00:32:44 2004 -0700 @@ -881,8 +881,7 @@ ////////////////////////////// // host name recognizer case h_end: { - count--; - pending[count] = 0; + pending[--count] = '\0'; // null terminate host name by overwriting the terminator char *tld; for (int i=0; (tld = tlds[i]); i++) { int n = strlen(tld); @@ -900,13 +899,13 @@ } break; ////////////////////////////// - // html tag { discarder - case t_end: + // html tag discarder + case t_end: { st = t_init; - // fall thru + } // fall thru case t_disc: { - count = 0; + count = 0; // discard all characters } break; case t_init: {