From: Vsevolod Stakhov Date: Fri, 11 Mar 2022 21:52:40 +0000 (+0000) Subject: [Minor] Reputation: Fix config variable X-Git-Tag: 3.2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6e1a528da6f47c03fd96586013b60129c4c7715;p=thirdparty%2Frspamd.git [Minor] Reputation: Fix config variable --- diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index 01c81d481c..98dea3e4f1 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -233,9 +233,10 @@ end local function dkim_reputation_postfilter(task, rule) local sym_accepted = task:get_symbol('R_DKIM_ALLOW') local accept_adjustment = task:get_mempool():get_variable("dkim_reputation_accept") + local cfg = rule.selector.config or E - if sym_accepted and accept_adjustment then - local final_adjustment = rule.config.max_accept_adjustment * + if sym_accepted and accept_adjustment and type(cfg.max_accept_adjustment) == 'number' then + local final_adjustment = cfg.max_accept_adjustment * rspamd_util.tanh(tonumber(accept_adjustment)) task:adjust_result('R_DKIM_ALLOW', sym_accepted.score * final_adjustment) end @@ -243,8 +244,8 @@ local function dkim_reputation_postfilter(task, rule) local sym_rejected = task:get_symbol('R_DKIM_REJECT') local reject_adjustment = task:get_mempool():get_variable("dkim_reputation_reject") - if sym_rejected and reject_adjustment then - local final_adjustment = rule.config.max_reject_adjustment * + if sym_rejected and reject_adjustment and type(cfg.max_reject_adjustment) == 'number' then + local final_adjustment = cfg.max_reject_adjustment * rspamd_util.tanh(tonumber(reject_adjustment)) task:adjust_result('R_DKIM_REJECT', sym_rejected.score * final_adjustment) end @@ -638,8 +639,6 @@ local spf_selector = { max_score = nil, outbound = true, inbound = true, - max_accept_adjustment = 2.0, -- How to adjust accepted DKIM score - max_reject_adjustment = 3.0 -- How to adjust rejected DKIM score }, dependencies = {"R_SPF_ALLOW"}, filter = spf_reputation_filter, -- used to get scores