]> source.dussan.org Git - rspamd.git/commitdiff
Do not check invalid IP addresses.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 20 Dec 2013 15:50:00 +0000 (15:50 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 20 Dec 2013 15:50:00 +0000 (15:50 +0000)
src/plugins/lua/multimap.lua
src/plugins/lua/rbl.lua

index 229d594cfb607696177a7cdaee5be2c593199efa..1711c212ec702c5bb80947a241f9fa5127a7799a 100644 (file)
@@ -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'])
index cb827e8548b493019f07c0b4927199774399cd23..e7e720908167908f9438b5203e147d7a17ab348f 100644 (file)
@@ -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