commit ee81bd5: [Minor] Fix --from argument

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Dec 1 14:49:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-12-01 14:43:38 +0000
URL: https://github.com/rspamd/rspamd/commit/ee81bd5e37e63e566ff37a85df1f501043fc3203 (HEAD -> master)

[Minor] Fix --from argument

---
 lualib/rspamadm/dns_tool.lua | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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


More information about the Commits mailing list