diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-28 12:39:48 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-28 12:39:48 +0000 |
commit | 71499b6811fdd2df0ecc7581120b83a0935b1370 (patch) | |
tree | cad2a2047d2ebf52b18980a2ffcff239be18196b /src/plugins/lua/dmarc.lua | |
parent | 772f3bb7ac6bba9fa9c885f0880c93c58cb59f5b (diff) | |
download | rspamd-71499b6811fdd2df0ecc7581120b83a0935b1370.tar.gz rspamd-71499b6811fdd2df0ecc7581120b83a0935b1370.zip |
[Test] Add tests for pct=0 case
Diffstat (limited to 'src/plugins/lua/dmarc.lua')
-rw-r--r-- | src/plugins/lua/dmarc.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index b55c5d41f..af43a5b8c 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -415,12 +415,15 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld) policy.domain .. ' : ' .. reason_str, policy.dmarc_policy) disposition = what else - if (math.random(100) > policy.pct) then + local coin = math.random(100) + if (coin > policy.pct) then if (not no_sampling_domains or not no_sampling_domains:get_key(policy.domain)) then task:insert_result(dmarc_symbols['softfail'], 1.0, policy.domain .. ' : ' .. reason_str, policy.dmarc_policy, "sampled_out") sampled_out = true + lua_util.debugm(N, task, 'changed dmarc policy from %s to %s, sampled out: %s < %s', + what, 'softfail', coin, policy.pct) else task:insert_result(dmarc_symbols[what], 1.0, policy.domain .. ' : ' .. reason_str, policy.dmarc_policy, "local_policy") |