]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix SPOOF_DISPLAY_NAME / FROM_NEQ_DISPLAY_NAME rules
authorAndrew Lewis <nerf@judo.za.org>
Mon, 27 Mar 2017 13:29:05 +0000 (15:29 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 27 Mar 2017 13:29:05 +0000 (15:29 +0200)
rules/misc.lua

index ae914ce215b4c36ac1310eaf4389b6193114c190..57c3ac05729bc2ae72a3d13eb361a2d2ffd0cc28 100644 (file)
@@ -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