diff options
author | Andrew Lewis <nerf@judo.za.org> | 2013-11-23 12:22:17 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2013-11-23 12:22:17 +0200 |
commit | ac7af46b8add2aae4fed1eecd8ec8fbd44514eb4 (patch) | |
tree | ce01ba8fb4994591df3477d50c151cfbea404ba4 | |
parent | 361c3abdf6d1841dde2aab8d949bfbdb6fa6fb05 (diff) | |
download | rspamd-ac7af46b8add2aae4fed1eecd8ec8fbd44514eb4.tar.gz rspamd-ac7af46b8add2aae4fed1eecd8ec8fbd44514eb4.zip |
Check all results
-rw-r--r-- | src/plugins/lua/rbl.lua | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index b45618229..0cfcf37d5 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -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 |