]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Reputation: Another try to fix dkim reputation
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 21 May 2022 12:33:25 +0000 (13:33 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 21 May 2022 12:33:48 +0000 (13:33 +0100)
src/plugins/lua/reputation.lua

index dd1cfd91337998a84ba10089510205b77021e144..0c8fc1c36cddf38abc2d36d2f45aa4a4d640be82 100644 (file)
@@ -218,8 +218,13 @@ local function dkim_reputation_filter(task, rule)
           rep_accepted_abs, rep_rejected_abs)
       if rep_accepted_abs > 0 or rep_rejected_abs > 0 then
         if rep_accepted_abs > rep_rejected_abs then
-          add_symbol_score(task, rule, -(rep_accepted_abs - rep_rejected_abs))
+          -- For accepted reputation we add symbol with just this reputation, either positive or negative
+          local final_rep = rep_accepted
+          if rep_accepted > 1.0 then final_rep = 1.0 end
+          if rep_accepted < -1.0 then final_rep = -1.0 end
+          add_symbol_score(task, rule, final_rep)
         else
+          -- For rejected case we use absolute values as it must always be positive
           add_symbol_score(task, rule, (rep_rejected_abs - rep_accepted_abs))
         end