]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Reputation: Check results before setting
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 24 Jul 2019 09:14:07 +0000 (10:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 24 Jul 2019 09:14:07 +0000 (10:14 +0100)
src/plugins/lua/reputation.lua

index aa6697eab41e4aa8d3495c62077787319d7f86aa..9e28e876bc21b6533a1e950a8f8277c7ac42c280 100644 (file)
@@ -484,14 +484,16 @@ local function ip_reputation_idempotent(task, rule)
     end
   end
   local sc = extract_task_score(task, rule)
-  if asn then
-    rule.backend.set_token(task, rule, cfg.asn_prefix .. asn, sc)
-  end
-  if country then
-    rule.backend.set_token(task, rule, cfg.country_prefix .. country, sc)
-  end
+  if sc then
+    if asn then
+      rule.backend.set_token(task, rule, cfg.asn_prefix .. asn, sc)
+    end
+    if country then
+      rule.backend.set_token(task, rule, cfg.country_prefix .. country, sc)
+    end
 
-  rule.backend.set_token(task, rule, cfg.ip_prefix .. tostring(ip), sc)
+    rule.backend.set_token(task, rule, cfg.ip_prefix .. tostring(ip), sc)
+  end
 end
 
 -- Selectors are used to extract reputation tokens