From f404efdffef3e35f92a8699e206bf6a761dedad3 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 18 Apr 2017 09:51:03 +0200 Subject: [PATCH] [Minor] DKIM signing: deal with ambiguous settings better --- src/plugins/lua/dkim_signing.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua index 2494161c4..1c1bc2b57 100644 --- a/src/plugins/lua/dkim_signing.lua +++ b/src/plugins/lua/dkim_signing.lua @@ -109,11 +109,15 @@ local function dkim_signing_cb(task) edom = rspamd_util.get_tld(edom) end end - if edom and hdom and not settings.allow_hdrfrom_mismatch and hdom ~= edom and - (not settings.allow_hdrfrom_mismatch_local or not is_local) and - (not settings.allow_hdrfrom_mismatch_sign_networks or not is_sign_networks) then - rspamd_logger.debugm(N, task, 'domain mismatch not allowed: %1 != %2', hdom, edom) - return false + if edom and hdom and not settings.allow_hdrfrom_mismatch and hdom ~= edom then + if settings.allow_hdrfrom_mismatch_local and is_local then + rspamd_logger.debugm(N, task, 'domain mismatch allowed for local IP: %1 != %2', hdom, edom) + elseif settings.allow_hdrfrom_mismatch_sign_networks and is_sign_networks then + rspamd_logger.debugm(N, task, 'domain mismatch allowed for sign_networks: %1 != %2', hdom, edom) + else + rspamd_logger.debugm(N, task, 'domain mismatch not allowed: %1 != %2', hdom, edom) + return false + end end if auser and not settings.allow_username_mismatch then local udom = string.match(auser, '.*@(.*)') -- 2.39.5