]> source.dussan.org Git - rspamd.git/commitdiff
Fix surbl module.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Nov 2013 14:52:59 +0000 (14:52 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Nov 2013 14:52:59 +0000 (14:52 +0000)
src/plugins/surbl.c

index dc62a98151d33d7c292befcb805471b744a347cb..397a26ba4d79f8e95b27b707e44c8c8ddc581f0e 100644 (file)
@@ -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)));