]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Validate assumed spoofed display name domains to contain a dot 1658/head
authorJulien Schmidt <git@julienschmidt.com>
Tue, 30 May 2017 11:32:12 +0000 (19:32 +0800)
committerJulien Schmidt <git@julienschmidt.com>
Tue, 30 May 2017 11:32:12 +0000 (19:32 +0800)
A displayname of the form <something>@<name> might have been mistaken
for an email address

rules/misc.lua

index fff5d04cc22b0db959432524a291ddb8af9722d2..509a56e67d5a67a0f914c0244dfb4558eeaac502 100644 (file)
@@ -515,13 +515,12 @@ local check_from_display_name = rspamd_config:register_symbol{
         -- 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'])
-        else
-          task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
+          return false
         end
-        return false
-      else
-        task:insert_result('FROM_NEQ_DISPLAY_NAME', 1.0, from[1]['domain'], parsed[1]['domain'])
       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
   end,