]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Validate assumed spoofed display name domains to contain a dot
authorJulien Schmidt <git@julienschmidt.com>
Tue, 30 May 2017 11:32:12 +0000 (19:32 +0800)
committerAndrew Lewis <nerf@judo.za.org>
Thu, 1 Jun 2017 15:40:30 +0000 (17:40 +0200)
A displayname of the form <something>@<name> might have been mistaken
for an email address

rules/misc.lua

index ab4a87508a6ab6a85fedf5502ce47407cd144ec0..af78f17811755b6ca0928315c7c6b605ffd5b5bc 100644 (file)
@@ -501,13 +501,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,