From: Andrew Lewis Date: Tue, 18 Apr 2017 07:51:03 +0000 (+0200) Subject: [Minor] DKIM signing: deal with ambiguous settings better X-Git-Tag: 1.5.6~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f404efdffef3e35f92a8699e206bf6a761dedad3;p=rspamd.git [Minor] DKIM signing: deal with ambiguous settings better --- 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, '.*@(.*)')