From: Florent Bruneau Date: Sun, 5 Oct 2008 16:12:44 +0000 (+0200) Subject: Fix crash in conf, improves debug logging for rbl. X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=commitdiff_plain;h=94227060565c512af24fcbafe270951c15bcbd9b Fix crash in conf, improves debug logging for rbl. Signed-off-by: Florent Bruneau --- diff --git a/common/rbl.c b/common/rbl.c index 11ed464..0ae4979 100644 --- a/common/rbl.c +++ b/common/rbl.c @@ -38,13 +38,17 @@ static inline rbl_result_t rbl_dns_check(const char *hostname) { + debug("looking up for %s", hostname); struct hostent *host = gethostbyname(hostname); if (host != NULL) { + debug("host found"); return RBL_FOUND; } else { if (h_errno == HOST_NOT_FOUND) { + debug("host not found: %s", hostname); return RBL_NOTFOUND; } + debug("dns error: %m"); return RBL_ERROR; } } diff --git a/postlicyd/config.c b/postlicyd/config.c index d4131f1..f2b8dbe 100644 --- a/postlicyd/config.c +++ b/postlicyd/config.c @@ -423,7 +423,7 @@ config_t *config_read(const char *file) config_t *config = config_new(); config->filename = file; if (!config_reload(config)) { - p_delete(&config); + config_delete(&config); return NULL; } return config; diff --git a/postlicyd/iplist.c b/postlicyd/iplist.c index 3c14fda..5337dca 100644 --- a/postlicyd/iplist.c +++ b/postlicyd/iplist.c @@ -378,7 +378,7 @@ static bool rbl_filter_constructor(filter_t *filter) } }} - PARSE_CHECK(data->rbls.len, + PARSE_CHECK(data->rbls.len || data->host_offsets.len, "no file parameter in the filter %s", filter->name); filter->data = data; return true; diff --git a/postlicyd/strlist.c b/postlicyd/strlist.c index 2f17f90..c350f22 100644 --- a/postlicyd/strlist.c +++ b/postlicyd/strlist.c @@ -487,7 +487,7 @@ static bool strlist_filter_constructor(filter_t *filter) PARSE_CHECK(config->is_email != config->is_hostname, "matched field MUST be emails XOR hostnames"); - PARSE_CHECK(config->tries.len, + PARSE_CHECK(config->tries.len || config->host_offsets.len, "no file parameter in the filter %s", filter->name); filter->data = config; return true; @@ -543,7 +543,7 @@ static filter_result_t strlist_filter(const filter_t *filter, const query_t *que if (config->match_ ## Flag) { \ const int len = m_strlen(query->Field); \ strlist_copy(normal, query->Field, len, false); \ - for (uint32_t i = 0 ; len > 0 && i < config->tries.len ; ++i) { \ + for (uint32_t i = 0 ; len > 0 && i < config->host_offsets.len ; ++i) { \ const char *rbl = array_ptr(config->hosts, \ array_elt(config->host_offsets, i));\ const int weight = array_elt(config->host_weights, i); \