aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-28 12:39:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-28 12:39:48 +0000
commit71499b6811fdd2df0ecc7581120b83a0935b1370 (patch)
treecad2a2047d2ebf52b18980a2ffcff239be18196b /src
parent772f3bb7ac6bba9fa9c885f0880c93c58cb59f5b (diff)
downloadrspamd-71499b6811fdd2df0ecc7581120b83a0935b1370.tar.gz
rspamd-71499b6811fdd2df0ecc7581120b83a0935b1370.zip
[Test] Add tests for pct=0 case
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/dmarc.lua5
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")