]> source.dussan.org Git - rspamd.git/commitdiff
Check all results
authorAndrew Lewis <nerf@judo.za.org>
Sat, 23 Nov 2013 10:22:17 +0000 (12:22 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Sat, 23 Nov 2013 10:22:17 +0000 (12:22 +0200)
src/plugins/lua/rbl.lua

index b456182295b64feb5cc6d4b00260c182e22c1f5a..0cfcf37d527903231a3a008d145f3f6477064f3e 100644 (file)
@@ -35,7 +35,6 @@ end
 local function rbl_cb (task)
        local function rbl_dns_cb(resolver, to_resolve, results, err)
                if results then
-                       local ipstr = results[1]:to_string()
                        local thisrbl = nil
                        for _,r in pairs(rbls) do
                                if string.ends(to_resolve, r['rbl']) then
@@ -49,29 +48,32 @@ local function rbl_cb (task)
                                                task:insert_result(thisrbl['symbol'], 1)
                                        end
                                else
-                                       local foundrc = false
-                                       for s,i in pairs(thisrbl['returncodes']) do
-                                               if type(i) == 'string' then
-                                                       if i == ipstr then
-                                                               foundrc = true
-                                                               task:insert_result(s, 1)
-                                                               break
-                                                       end
-                                               elseif type(i) == 'table' then
-                                                       for _,v in pairs(i) do
-                                                               if v == ipstr then
+                                       for _,result in pairs(results) do 
+                                               local ipstr = result:to_string()
+                                               local foundrc = false
+                                               for s,i in pairs(thisrbl['returncodes']) do
+                                                       if type(i) == 'string' then
+                                                               if i == ipstr then
                                                                        foundrc = true
                                                                        task:insert_result(s, 1)
                                                                        break
                                                                end
+                                                       elseif type(i) == 'table' then
+                                                               for _,v in pairs(i) do
+                                                                       if v == ipstr then
+                                                                               foundrc = true
+                                                                               task:insert_result(s, 1)
+                                                                               break
+                                                                       end
+                                                               end
                                                        end
                                                end
-                                       end
-                                       if not foundrc then
-                                               if thisrbl['unknown'] and thisrbl['symbol'] then
-                                                       task:insert_result(thisrbl['symbol'], 1)
-                                               else
-                                                       rspamd_logger.err('RBL ' .. thisrbl['rbl'] .. ' returned unknown result ' .. ipstr)
+                                               if not foundrc then
+                                                       if thisrbl['unknown'] and thisrbl['symbol'] then
+                                                               task:insert_result(thisrbl['symbol'], 1)
+                                                       else
+                                                               rspamd_logger.err('RBL ' .. thisrbl['rbl'] .. ' returned unknown result ' .. ipstr)
+                                                       end
                                                end
                                        end
                                end