commit e6e1a52: [Minor] Reputation: Fix config variable

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Mar 11 21:56:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-03-11 21:52:40 +0000
URL: https://github.com/rspamd/rspamd/commit/e6e1a528da6f47c03fd96586013b60129c4c7715 (HEAD -> master)

[Minor] Reputation: Fix config variable

---
 src/plugins/lua/reputation.lua | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua
index 01c81d481..98dea3e4f 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


More information about the Commits mailing list