diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-03-13 15:54:10 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-03-13 15:54:10 +0000 |
commit | 7dfe495e68efc52559f9459d87d303ec505eb833 (patch) | |
tree | 765beed7981035e823000e2ebc672bfdcae3613e /src/plugins/lua | |
parent | 708b461cc825778d68da39653d6180d15a978d45 (diff) | |
download | rspamd-7dfe495e68efc52559f9459d87d303ec505eb833.tar.gz rspamd-7dfe495e68efc52559f9459d87d303ec505eb833.zip |
[Minor] Another fix for `task:get_symbol`
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/reputation.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index 24ff03bc0..ff292525a 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -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) |