summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-03-20 13:58:39 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-03-20 14:00:11 +0200
commit85ff1ff9c1e30329a67c37bfa337a42e449f72fd (patch)
tree53564f9092e27d470f4a70f062725bc5cfe6e6cf
parentdeb2a10153127d91f2b846362d865b5a09b5af46 (diff)
downloadrspamd-85ff1ff9c1e30329a67c37bfa337a42e449f72fd.tar.gz
rspamd-85ff1ff9c1e30329a67c37bfa337a42e449f72fd.zip
[Minor] DMARC: Add descriptive errors; properly handle empty domain
-rw-r--r--src/plugins/lua/dmarc.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index eddb93d76..4fe7f93cc 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -101,8 +101,14 @@ local function dmarc_callback(task)
rspamd_logger.infox(task, "skip DMARC checks for local networks and authorized users");
return
end
- if ((from or E)[1] or E).domain and not (from or E)[2] then
+ if ((from or E)[1] or E).domain and ((from or E)[1] or E).domain ~= '' and not (from or E)[2] then
dmarc_domain = rspamd_util.get_tld(from[1]['domain'])
+ elseif (from or E)[2] then
+ task:insert_result(dmarc_symbols['na'], 1.0, 'Duplicate From header')
+ return maybe_force_action('na')
+ elseif (from or E)[1] then
+ task:insert_result(dmarc_symbols['na'], 1.0, 'No domain in From header')
+ return maybe_force_action('na')
else
task:insert_result(dmarc_symbols['na'], 1.0, 'No From header')
return maybe_force_action('na')