From a85e61f5a5437235a3b263b4f7a87425a1244b86 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 26 Nov 2013 14:52:59 +0000 Subject: [PATCH] Fix surbl module. --- src/plugins/surbl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index dc62a9815..397a26ba4 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -402,6 +402,7 @@ surbl_module_config (struct config_file *cfg) } cur = ucl_obj_get_key (cur_rule, "bits"); if (cur != NULL && cur->type == UCL_OBJECT) { + it = NULL; while ((cur_bit = ucl_iterate_object (cur, &it, true)) != NULL) { if (ucl_object_key (cur_bit) != NULL && cur_bit->type == UCL_INT) { bit = ucl_obj_toint (cur_bit); @@ -414,11 +415,13 @@ surbl_module_config (struct config_file *cfg) } } surbl_module_ctx->suffixes = g_list_prepend (surbl_module_ctx->suffixes, new_suffix); + register_callback_symbol (&cfg->cache, new_suffix->symbol, 1, surbl_test_url, new_suffix); } } /* Add default suffix */ if (surbl_module_ctx->suffixes == NULL) { msg_err ("surbl module loaded but no suffixes defined, skip checks"); + return TRUE; } if (surbl_module_ctx->suffixes != NULL) { @@ -653,7 +656,6 @@ process_dns_results (struct worker_task *task, struct suffix_item *suffix, gchar { GList *cur; struct surbl_bit_item *bit; - gint found = 0; if (suffix->bits != NULL) { cur = g_list_first (suffix->bits); @@ -663,14 +665,9 @@ process_dns_results (struct worker_task *task, struct suffix_item *suffix, gchar debug_task ("got result(%d) AND bit(%d): %d", (gint)addr, (gint)ntohl (bit->bit), (gint)bit->bit & (gint)ntohl (addr)); if (((gint)bit->bit & (gint)ntohl (addr)) != 0) { insert_result (task, bit->symbol, 1, g_list_prepend (NULL, memory_pool_strdup (task->task_pool, url))); - found = 1; } cur = g_list_next (cur); } - - if (!found) { - insert_result (task, suffix->symbol, 1, g_list_prepend (NULL, memory_pool_strdup (task->task_pool, url))); - } } else { insert_result (task, suffix->symbol, 1, g_list_prepend (NULL, memory_pool_strdup (task->task_pool, url))); -- 2.39.5