diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-17 13:40:29 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-17 13:40:29 +0000 |
commit | dd565e0282c7de929a656f52ccc061d89c8deffb (patch) | |
tree | 4896d750c4614ddb46d3cbda9a9c881c6e7da8f2 /src | |
parent | adf7e9733ac8d4b3816279bc96e6672f982052ff (diff) | |
download | rspamd-dd565e0282c7de929a656f52ccc061d89c8deffb.tar.gz rspamd-dd565e0282c7de929a656f52ccc061d89c8deffb.zip |
Treat '__' symbols as ghost symbols.
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/symbols_cache.c | 2 | ||||
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 0ecd6e6e8..248372d29 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 03387255b..bb96fb2e8 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 |