aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/multimap.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-21 14:58:21 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-21 15:04:02 +0100
commite72d601aa62fb517415e77fb5a4de95651939872 (patch)
tree93c5a5ced9929004e572a9e20a1648645595012d /src/plugins/lua/multimap.lua
parent9c549e66a047b61d71e087617f67932781158f6b (diff)
downloadrspamd-e72d601aa62fb517415e77fb5a4de95651939872.tar.gz
rspamd-e72d601aa62fb517415e77fb5a4de95651939872.zip
Fix lua plugins with the new DNS API.
Diffstat (limited to 'src/plugins/lua/multimap.lua')
-rw-r--r--src/plugins/lua/multimap.lua25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index cd6aa5a1c..3f41921f1 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -37,17 +37,6 @@ local function ip_to_rbl(ip, rbl)
end
local function check_multimap(task)
- -- Generate dns callback closure
- local function dns_cb_generator(r)
- local cb = function (resolver, to_resolve, results, err, rbl)
- task:inc_dns_req()
- if results then
- task:insert_result(r['symbol'], 1, r['map'])
- end
- end
- return cb
- end
-
-- Match a single value for against a single rule
local function match_rule(r, value)
local ret = false
@@ -142,9 +131,17 @@ local function check_multimap(task)
-- RBL rules
if ip:is_valid() then
_.each(function(r)
- task:get_resolver():resolve_a(task:get_session(), task:get_mempool(),
- ip_to_rbl(ip, r['map']), dns_cb_generator(r))
- end,
+ local cb = function (resolver, to_resolve, results, err, rbl)
+ if results then
+ task:insert_result(r['symbol'], 1, r['map'])
+ end
+ end
+
+ task:get_resolver():resolve_a({task = task,
+ name = ip_to_rbl(ip, r['map']),
+ callback = cb,
+ })
+ end,
_.filter(function(r) return r['type'] == 'dnsbl' end, rules))
end
end