]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not fail rbl plugin when there are no received or emails
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 28 Jul 2017 17:59:46 +0000 (18:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 28 Jul 2017 17:59:46 +0000 (18:59 +0100)
src/plugins/lua/rbl.lua

index a6b54539ead484b56fb76c07d98c4b7e4a3938bf..55f2bffea216630f96a38e353f0b265b8a9acd12 100644 (file)
@@ -159,7 +159,10 @@ local function rbl_cb (task)
     return params[to_resolve]
   end
 
-  local havegot = {}
+  local havegot = {
+    emails = {},
+    received = {}
+  }
   local notgot = {}
 
   local alive_rbls = fun.filter(function(_, rbl)
@@ -242,10 +245,11 @@ local function rbl_cb (task)
       if notgot['emails'] then
         return false
       end
-      if not havegot['emails'] then
+      if #havegot['emails'] == 0 then
         havegot['emails'] = task:get_emails()
         if havegot['emails'] == nil then
           notgot['emails'] = true
+          havegot['emails'] = {}
           return false
         end
       end
@@ -264,10 +268,11 @@ local function rbl_cb (task)
       if notgot['received'] then
         return false
       end
-      if not havegot['received'] then
+      if #havegot['received'] == 0 then
         havegot['received'] = task:get_received_headers()
         if next(havegot['received']) == nil then
           notgot['received'] = true
+          havegot['received'] = {}
           return false
         end
       end