commit 569608d: [Fix] Try to fix some broken code in DMARC reporting plugin
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun May 16 20:42:03 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-05-16 21:36:17 +0100
URL: https://github.com/rspamd/rspamd/commit/569608dd20d1790a48c4bff615fdc2ccccb2c111 (HEAD -> master)
[Fix] Try to fix some broken code in DMARC reporting plugin
Issue: #2499
---
src/plugins/lua/dmarc.lua | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index f216738f6..d6dc4947c 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -1072,30 +1072,18 @@ if opts['reporting'] == true then
end
local function verify_reporting_address()
local function verifier(test_addr, vdom)
- local retry = 0
local function verify_cb(resolver, to_resolve, results, err, _, authenticated)
if err then
- if err == 'no records with this name' or err == 'requested record is not found' then
- rspamd_logger.infox(rspamd_config, 'reports to %s for %s not authorised', test_addr, reporting_domain)
- to_verify[test_addr] = nil
- else
- rspamd_logger.errx(rspamd_config, 'lookup error [%s]: %s', to_resolve, err)
- if retry < report_settings.retries then
- retry = retry + 1
- rspamd_config:get_resolver():resolve('txt', {
- ev_base = ev_base,
- name = string.format('%s._report._dmarc.%s',
- reporting_domain, vdom),
- callback = verify_cb,
- })
- else
- delete_reports()
- end
- end
+ rspamd_logger.errx(rspamd_config, 'lookup error [%s]: %s',
+ to_resolve, err)
+ rspamd_logger.infox(rspamd_config, 'reports to %s for %s not authorised',
+ test_addr, reporting_domain)
+ to_verify[test_addr] = nil
else
local is_authed = false
-- XXX: reporting address could be overridden
for _, r in ipairs(results) do
+ -- Oh wow
if string.match(r, 'v=DMARC1') then
is_authed = true
break
@@ -1109,6 +1097,7 @@ if opts['reporting'] == true then
reporting_addrs[test_addr] = true
end
end
+ -- TODO: wtf this code does???
local t, nvdom = next(to_verify)
if not t then
if next(reporting_addrs) then
@@ -1128,6 +1117,7 @@ if opts['reporting'] == true then
callback = verify_cb,
})
end
+ -- TODO: recursion and wtf again
local t, vdom = next(to_verify)
verifier(t, vdom)
end
More information about the Commits
mailing list