]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] DMARC: Fix alignment checking for subdomains 882/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 22 Aug 2016 12:47:18 +0000 (14:47 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 22 Aug 2016 13:52:49 +0000 (15:52 +0200)
src/plugins/lua/dmarc.lua

index 74f395cf86368ed0245be6652cb0113aae0a23d1..d9961956f422de9946f8ac46be51e7794a73279a 100644 (file)
@@ -213,9 +213,8 @@ local function dmarc_callback(task)
         if rspamd_util.strequal_caseless(efrom[1]['domain'], from[1]['domain']) then
           spf_ok = true
         elseif not strict_spf then
-          if rspamd_util.strequal_caseless(
-              string.sub(efrom[1]['domain'], -string.len('.' .. lookup_domain)),
-              '.' .. lookup_domain) then
+          local spf_tld = rspamd_util.get_tld(efrom[1]['domain'])
+          if rspamd_util.strequal_caseless(spf_tld, dmarc_domain) then
             spf_ok = true
           end
         end
@@ -227,9 +226,8 @@ local function dmarc_callback(task)
         if rspamd_util.strequal_caseless(from[1]['domain'], dkim_domain) then
           dkim_ok = true
         elseif not strict_dkim then
-          if rspamd_util.strequal_caseless(
-              string.sub(dkim_domain, -string.len('.' .. lookup_domain)),
-              '.' .. lookup_domain) then
+          local dkim_tld = rspamd_util.get_tld(dkim_domain)
+          if rspamd_util.strequal_caseless(dkim_tld, dmarc_domain) then
             dkim_ok = true
           end
         end