From 8f7a43d5a44ffe9e8ba5343406ef3682bf57fe86 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 14 Oct 2020 15:32:37 +0100 Subject: [PATCH] [Fix] Multimap: Fix scoring for combined maps --- src/plugins/lua/multimap.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 1ef2dbe12..c253c660e 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -544,7 +544,7 @@ local function multimap_callback(task, rule) return true,nil,1.0 end elseif type(p_ret) == 'boolean' then - return p_ret,nil,0.0 + return p_ret,nil,1.0 end return false,nil,0.0 @@ -1270,12 +1270,16 @@ if opts and type(opts) == 'table' then rspamd_logger.infox(rspamd_config, 'set default score 0 for multimap rule %s', rule.symbol) rule.score = 0 end - if rule['score'] then + if rule.score then -- Register metric symbol rule.name = rule.symbol rule.description = rule.description or 'multimap symbol' rule.group = rule.group or N + -- XXX: for combined maps we use trace, so flags must include one_shot to avoid scores multiplication + if rule.combined and not rule.flags then + rule.flags = 'one_shot' + end rspamd_config:set_metric_symbol(rule) end end, fun.filter(function(r) return not r['prefilter'] end, rules)) -- 2.39.5