aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-12-01 14:43:38 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-12-01 14:43:38 +0000
commitee81bd5e37e63e566ff37a85df1f501043fc3203 (patch)
tree0a25c9988cc24ae02592d57437d421c38e578ebd
parent0007aabece04ca4b86447a6abd259f4cef70731e (diff)
downloadrspamd-ee81bd5e37e63e566ff37a85df1f501043fc3203.tar.gz
rspamd-ee81bd5e37e63e566ff37a85df1f501043fc3203.zip
[Minor] Fix --from argument
-rw-r--r--lualib/rspamadm/dns_tool.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/lualib/rspamadm/dns_tool.lua b/lualib/rspamadm/dns_tool.lua
index f45f4a4a3..91a726d09 100644
--- a/lualib/rspamadm/dns_tool.lua
+++ b/lualib/rspamadm/dns_tool.lua
@@ -98,7 +98,14 @@ local function spf_handler(opts)
end
if opts.from then
- task:set_from('smtp', {addr = opts.from})
+ local rspamd_parsers = require "rspamd_parsers"
+ local addr_parsed = rspamd_parsers.parse_mail_address(opts.from)
+ if addr_parsed then
+ task:set_from('smtp', addr_parsed[1])
+ else
+ io.stderr:write('Invalid from addr\n')
+ os.exit(1)
+ end
elseif opts.domain then
task:set_from('smtp', {user = 'user', domain = opts.domain})
else