]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Reputation: Fix config variable
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Mar 2022 21:52:40 +0000 (21:52 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Mar 2022 21:52:40 +0000 (21:52 +0000)
src/plugins/lua/reputation.lua

index 01c81d481c6a3690b20aa862bf4b4f93839460a7..98dea3e4f1c98a44a0ebd9b3c6a41acdd28a6c25 100644 (file)
@@ -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