diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-17 16:18:50 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-17 16:18:50 +0000 |
commit | cf96ddf8a1d29eb75ba825bbe8bf3c3fdfc181a9 (patch) | |
tree | b21b1c02a5892960712ffca1f00ea1affad3f3ca /src/plugins | |
parent | 9d538ae705f4be1c49adc11ae21a366702711b5b (diff) | |
download | rspamd-cf96ddf8a1d29eb75ba825bbe8bf3c3fdfc181a9.tar.gz rspamd-cf96ddf8a1d29eb75ba825bbe8bf3c3fdfc181a9.zip |
[Feature] Use different callback symbols for different uribls
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/reputation.lua | 2 | ||||
-rw-r--r-- | src/plugins/surbl.c | 22 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index f1111c85c..56201f7dc 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 ee1904005..f23373766 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"); |