From 597fd990eed12944a739761aac81f2f26377a7e5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 20 Dec 2013 15:50:00 +0000 Subject: [PATCH] Do not check invalid IP addresses. --- src/plugins/lua/multimap.lua | 2 +- src/plugins/lua/rbl.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 229d594cf..1711c212e 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -66,7 +66,7 @@ local function check_multimap(task) end elseif rule['type'] == 'dnsbl' then local ip = task:get_from_ip() - if ip and ip ~= "0.0.0.0" then + if ip and ip:to_string() ~= "0.0.0.0" then if ip:get_version() == 6 and rule['ipv6'] then task:get_resolver():resolve_a(task:get_session(), task:get_mempool(), ip_to_rbl(ip, rule['map']), multimap_rbl_cb, rule['map']) diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index cb827e854..e7e720908 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -78,7 +78,7 @@ local function rbl_cb (task) end local rip = task:get_from_ip() - if(rip:to_string() ~= "0.0.0.0") then + if rip and (rip:to_string() ~= '0.0.0.0') then for k,rbl in pairs(rbls) do if (rip:get_version() == 6 and rbl['ipv6'] and rbl['from']) or (rip:get_version() == 4 and rbl['ipv4'] and rbl['from']) then @@ -89,7 +89,7 @@ local function rbl_cb (task) end local recvh = task:get_received_headers() for _,rh in ipairs(recvh) do - if rh['real_ip'] then + if rh['real_ip'] and rh['real_ip']:to_string() ~= '0.0.0.0' then for k,rbl in pairs(rbls) do if (rh['real_ip']:get_version() == 6 and rbl['ipv6'] and rbl['received']) or (rh['real_ip']:get_version() == 4 and rbl['ipv4'] and rbl['received']) then -- 2.39.5