summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-01 16:29:56 +0100
committerGitHub <noreply@github.com>2017-06-01 16:29:56 +0100
commit3c36cfd12d53fe267b99ae7f032de0adfbb7a06a (patch)
tree9d495228201d73855edca6a40221606a3affeeb8
parent0c5d1f986a0bf2ee4c45427b067a45c85240f7f8 (diff)
parent90c9ee87d56b5b4ec437cdad464d3523b2e074d2 (diff)
downloadrspamd-3c36cfd12d53fe267b99ae7f032de0adfbb7a06a.tar.gz
rspamd-3c36cfd12d53fe267b99ae7f032de0adfbb7a06a.zip
Merge pull request #1659 from fatalbanana/sdn
[Minor] SPOOF_DISPLAY_NAME: Use all SMTP/MIME recipients
-rw-r--r--rules/misc.lua27
1 files changed, 18 insertions, 9 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index 509a56e67..cf7ca3d42 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -506,20 +506,29 @@ local check_from_display_name = rspamd_config:register_symbol{
local parsed = util.parse_mail_address(from[1].name)
if not parsed then return false end
if not (parsed[1] and parsed[1]['addr']) then return false end
- if parsed[1]['domain'] == nil or parsed[1]['domain'] == '' then return false end
+ -- Make sure we did not mistake e.g. <something>@<name> for an email address
+ if not parsed[1]['domain'] or not parsed[1]['domain']:find('%.') then return false end
-- See if the parsed domains differ
if not util.strequal_caseless(from[1]['domain'], parsed[1]['domain']) then
-- See if the destination domain is the same as the spoof
- local to = task:get_recipients(2)
- if (to and to[1] and to[1]['domain']) then
- -- Be careful with undisclosed-recipients:; as domain will be an empty string
- if to[1]['domain'] ~= '' and util.strequal_caseless(to[1]['domain'], parsed[1]['domain']) then
- task:insert_result('SPOOF_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
- return false
+ local mto = task:get_recipients(2)
+ local sto = task:get_recipients(1)
+ if mto then
+ for _, to in ipairs(mto) do
+ if to['domain'] ~= '' and util.strequal_caseless(to['domain'], parsed[1]['domain']) then
+ task:insert_result('SPOOF_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
+ return false
+ end
+ end
+ end
+ if sto then
+ for _, to in ipairs(sto) do
+ if to['domain'] ~= '' and util.strequal_caseless(to['domain'], parsed[1]['domain']) then
+ task:insert_result('SPOOF_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
+ return false
+ end
end
end
- -- Make sure we did not mistake e.g. <something>@<name> for an email address
- if not parsed[1]['domain']:find('%.') then return false end
task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
end
return false