diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-24 10:14:07 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-24 10:14:07 +0100 |
commit | f95b1d975c9f768b386299a352a740d7a855a982 (patch) | |
tree | aecbc44a1d20486013222a48042e8586fd40a844 /src | |
parent | 7bf0031790ef9c4d1bb8765745044d7bbeb874ea (diff) | |
download | rspamd-f95b1d975c9f768b386299a352a740d7a855a982.tar.gz rspamd-f95b1d975c9f768b386299a352a740d7a855a982.zip |
[Minor] Reputation: Check results before setting
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/reputation.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index aa6697eab..9e28e876b 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -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 |