From: Vsevolod Stakhov Date: Sat, 17 Nov 2018 16:18:50 +0000 (+0000) Subject: [Feature] Use different callback symbols for different uribls X-Git-Tag: 1.8.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf96ddf8a1d29eb75ba825bbe8bf3c3fdfc181a9;p=thirdparty%2Frspamd.git [Feature] Use different callback symbols for different uribls --- diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index f1111c85c7..56201f7dc6 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -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 } diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index ee19040056..f233737666 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -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");