]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Feature] Use different callback symbols for different uribls
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 17 Nov 2018 16:18:50 +0000 (16:18 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 17 Nov 2018 16:18:50 +0000 (16:18 +0000)
src/plugins/lua/reputation.lua
src/plugins/surbl.c

index f1111c85c735f68f1ffd498745398753e56d0b1f..56201f7dc6dbf42588370a6778a855926dcf3dc4 100644 (file)
@@ -354,7 +354,7 @@ local url_selector = {
     outbound = true,
     inbound = true,
   },
-  dependencies = {"SURBL_CALLBACK"},
+  dependencies = {"SURBL_REDIRECTOR_CALLBACK"},
   filter = url_reputation_filter, -- used to get scores
   idempotent = url_reputation_idempotent -- used to set scores
 }
index ee190400564aaf01fb3c2b7f98c35f499c479365..f233737666b456748e3ad7f8eee1fab11b5811c2 100644 (file)
@@ -762,10 +762,30 @@ surbl_module_parse_rule (const ucl_object_t* value, struct rspamd_config* cfg)
                        continue;
                }
 
-               cb_id = rspamd_symcache_add_symbol (cfg->cache, "SURBL_CALLBACK",
+               GString *sym = g_string_sized_new (127);
+               gchar *p;
+
+               rspamd_printf_gstring (sym, "SURBL_%s",
+                               new_suffix->suffix);
+
+               p = sym->str;
+
+               while (*p) {
+                       if (*p == '.') {
+                               *p = '_';
+                       }
+                       else {
+                               *p = g_ascii_toupper (*p);
+                       }
+
+                       p ++;
+               }
+
+               cb_id = rspamd_symcache_add_symbol (cfg->cache, sym->str,
                                0, surbl_test_url, new_suffix, SYMBOL_TYPE_CALLBACK, -1);
                rspamd_symcache_add_dependency (cfg->cache, cb_id,
                                SURBL_REDIRECTOR_CALLBACK);
+               g_string_free (sym, TRUE);
                nrules++;
                new_suffix->callback_id = cb_id;
                cur = ucl_object_lookup (cur_rule, "bits");