opendkim: report DKIM error code in SMTP response

This commit is contained in:
missytake
2025-12-10 08:12:10 +01:00
committed by holger krekel
parent d76b33def1
commit 40fd62c562

View File

@@ -10,6 +10,7 @@ if nsigs == nil then
end
local valid = false
local sigerrors = ""
for i = 1, nsigs do
sig = odkim.get_sighandle(ctx, i - 1)
sigres = odkim.sig_result(sig)
@@ -21,6 +22,8 @@ for i = 1, nsigs do
-- means the message is acceptable.
if sigres == 0 then
valid = true
else
sigerrors = sigerrors .. " " .. tostring(sigres)
end
end
@@ -31,7 +34,7 @@ if valid then
odkim.del_header(ctx, "DKIM-Signature", i)
end
else
odkim.set_reply(ctx, "554", "5.7.1", "No valid DKIM signature found")
odkim.set_reply(ctx, "554", "5.7.1", "No valid DKIM signature found. Search https://github.com/trusteddomainproject/OpenDKIM/blob/master/libopendkim/dkim.h#L108 for " .. sigerrors)
odkim.set_result(ctx, SMFIS_REJECT)
end