From: Vsevolod Stakhov Date: Tue, 17 Feb 2015 13:40:29 +0000 (+0000) Subject: Treat '__' symbols as ghost symbols. X-Git-Tag: 0.9.0~679 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd565e0282c7de929a656f52ccc061d89c8deffb;p=thirdparty%2Frspamd.git Treat '__' symbols as ghost symbols. --- diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 0ecd6e6e85..248372d292 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -366,7 +366,7 @@ register_symbol_common (struct symbols_cache **cache, /* Check whether this item is skipped */ skipped = !ghost; - if (!item->is_callback && pcache->cfg && + if (!ghost && !item->is_callback && pcache->cfg && g_hash_table_lookup (pcache->cfg->metrics_symbols, name) == NULL) { cur = g_list_first (pcache->cfg->metrics_list); while (cur) { diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 03387255b8..bb96fb2e8c 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -132,6 +132,14 @@ end -- Now check all valid rules and add the according rspamd rules +local function calculate_score(sym) + if _.all(function(c) return c == '_' end, _.take_n(2, _.iter(sym))) then + return 0.0 + end + + return 1.0 +end + -- Meta rules _.each(function(k, r) rspamd_config:add_composite(k, r['meta']) @@ -158,7 +166,7 @@ _.each(function(k, r) end end end - rspamd_config:register_symbol(k, 1.0, f) + rspamd_config:register_symbol(k, calculate_score(k), f) if r['score'] then rspamd_config:set_metric_symbol(k, r['score'], r['description']) end @@ -182,7 +190,7 @@ _.each(function(k, r) end end end - rspamd_config:register_symbol(k, 1.0, f) + rspamd_config:register_symbol(k, calculate_score(k), f) if r['score'] then rspamd_config:set_metric_symbol(k, r['score'], r['description']) end @@ -200,7 +208,7 @@ _.each(function(k, r) return end end - rspamd_config:register_symbol(k, 1.0, f) + rspamd_config:register_symbol(k, calculate_score(k), f) if r['score'] then rspamd_config:set_metric_symbol(k, r['score'], r['description']) end