]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another fix for `task:get_symbol`
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 13 Mar 2022 15:54:10 +0000 (15:54 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 13 Mar 2022 15:54:10 +0000 (15:54 +0000)
src/plugins/lua/reputation.lua

index 24ff03bc01ad4f49b1f762c7c9e9a4f8f87b684d..ff292525a7304d59f653c9695e34a5252d0d2258 100644 (file)
@@ -234,20 +234,22 @@ local function dkim_reputation_idempotent(task, rule)
 end
 
 local function dkim_reputation_postfilter(task, rule)
-  local sym_accepted = task:get_symbol('R_DKIM_ALLOW')
+  local sym_accepted = (task:get_symbol('R_DKIM_ALLOW') or E)[1]
   local accept_adjustment = task:get_mempool():get_variable("dkim_reputation_accept")
   local cfg = rule.selector.config or E
 
-  if sym_accepted and accept_adjustment and type(cfg.max_accept_adjustment) == 'number' then
+  if sym_accepted and sym_accepted.score and
+      accept_adjustment and type(cfg.max_accept_adjustment) == 'number' then
     local final_adjustment = cfg.max_accept_adjustment *
         rspamd_util.tanh(tonumber(accept_adjustment) or 0)
     task:adjust_result('R_DKIM_ALLOW', sym_accepted.score * final_adjustment)
   end
 
-  local sym_rejected = task:get_symbol('R_DKIM_REJECT')
+  local sym_rejected = (task:get_symbol('R_DKIM_REJECT') or E)[1]
   local reject_adjustment = task:get_mempool():get_variable("dkim_reputation_reject")
 
-  if sym_rejected and reject_adjustment and type(cfg.max_reject_adjustment) == 'number' then
+  if sym_rejected and sym_rejected.score and
+      reject_adjustment and type(cfg.max_reject_adjustment) == 'number' then
     local final_adjustment = cfg.max_reject_adjustment *
         rspamd_util.tanh(tonumber(reject_adjustment) or 0)
     task:adjust_result('R_DKIM_REJECT', sym_rejected.score * final_adjustment)