]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] MID module: Fix DKIM domain matching 2734/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Mon, 28 Jan 2019 08:02:32 +0000 (11:02 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Mon, 28 Jan 2019 08:02:32 +0000 (11:02 +0300)
src/plugins/lua/mid.lua

index 5410e7f9f189910beddbd0bfadbc8a100c78e031..0eccd360bdf6f4a0bb4b8945691a0afc9a64d1fa 100644 (file)
@@ -49,18 +49,20 @@ local function known_mid_cb(task)
   local das = task:get_symbol(settings['symbol_dkim_allow'])
   if ((das or E)[1] or E).options then
     for _,dkim_domain in ipairs(das[1]['options']) do
-      local v = map:get_key(dkim_domain)
-      if v then
-        if v == '' then
-          if not header then
-            task:insert_result(settings['symbol_known_no_mid'], 1, dkim_domain)
-            return
-          end
-        else
-          re[dkim_domain] = rspamd_regexp.create_cached(v)
-          if header and re[dkim_domain] and re[dkim_domain]:match(header) then
+      if dkim_domain then
+        local v = map:get_key(dkim_domain:match "[^:]+")
+        if v then
+          if v == '' then
+            if not header then
+              task:insert_result(settings['symbol_known_no_mid'], 1, dkim_domain)
+              return
+            end
+          else
+            re[dkim_domain] = rspamd_regexp.create_cached(v)
+            if header and re[dkim_domain] and re[dkim_domain]:match(header) then
               task:insert_result(settings['symbol_known_mid'], 1, dkim_domain)
               return
+            end
           end
         end
       end