summaryrefslogtreecommitdiffstats
path: root/rules/misc.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-03-27 15:29:05 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-03-27 15:29:05 +0200
commit0c1ce161f1ef22a32d4a545136c73f4f80ed40d6 (patch)
tree94c617115bb8c8e2c865fe11c33ae57d6e3f1864 /rules/misc.lua
parentb4d21068485572aeb72971d0aaaf8d5cbb4e3641 (diff)
downloadrspamd-0c1ce161f1ef22a32d4a545136c73f4f80ed40d6.tar.gz
rspamd-0c1ce161f1ef22a32d4a545136c73f4f80ed40d6.zip
[Minor] Fix SPOOF_DISPLAY_NAME / FROM_NEQ_DISPLAY_NAME rules
Diffstat (limited to 'rules/misc.lua')
-rw-r--r--rules/misc.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index ae914ce21..57c3ac057 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -455,15 +455,16 @@ local check_from_display_name = rspamd_config:register_symbol{
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 not (to and to[1] and to[1]['domain']) then
+ 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'] == nil or to[1]['domain'] == '' then return false end
- task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
- return false
- end
- if util.strequal_caseless(to[1]['domain'], parsed[1]['domain']) then
- task:insert_result('SPOOF_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
+ 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'])
+ else
+ task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
+ end
return false
+ else
+ task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
end
end
return false