]> source.dussan.org Git - rspamd.git/commitdiff
Update plugins.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 29 Mar 2014 23:16:37 +0000 (16:16 -0700)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 29 Mar 2014 23:16:37 +0000 (16:16 -0700)
src/plugins/lua/ip_score.lua
src/plugins/lua/multimap.lua

index ab8258a89ff7eb31df991c0c3137f1172a118e7f..ebec5252a048647fa791c8a1c3ba4aac13532f71 100644 (file)
@@ -41,7 +41,7 @@ local ip_score_set = function(task)
                -- Check whitelist 
                if whitelist then
                        local ipnum = task:get_from_ip():to_number()
-                       if ipnum and whitelist:get_key(ipnum) then
+                       if task:get_from_ip():is_valid() and whitelist:get_key(ipnum) then
                                -- Address is whitelisted
                                return
                        end
@@ -49,7 +49,7 @@ local ip_score_set = function(task)
                -- Now check action
                if action == 'reject' then
                        local ip = task:get_from_ip()
-                       if ip then
+                       if ip:is_valid() then
                                local cb = make_key_cb(ip)
                                if reject_score > 0 then
                                        rspamd_redis.make_request(task, keystorage_host, keystorage_port, cb, 'INCRBY %b %b', ip, reject_score)
@@ -59,7 +59,7 @@ local ip_score_set = function(task)
                        end
                elseif action == 'add header' then
                        local ip = task:get_from_ip()
-                       if ip then
+                       if ip:is_valid() then
                                local cb = make_key_cb(ip)
                                if add_header_score > 0 then
                                        rspamd_redis.make_request(task, keystorage_host, keystorage_port, cb, 'INCRBY %b %b', ip, add_header_score)
@@ -69,7 +69,7 @@ local ip_score_set = function(task)
                        end
                elseif action == 'no action' then
                        local ip = task:get_from_ip()
-                       if ip then
+                       if ip:is_valid() then
                                local cb = make_key_cb(ip)
                                if no_action_score > 0 then
                                        rspamd_redis.make_request(task, keystorage_host, keystorage_port, cb, 'INCRBY %b %b', ip, no_action_score)
@@ -101,7 +101,7 @@ local ip_score_check = function(task)
                end
        end
        local ip = task:get_from_ip()
-       if ip then
+       if ip:is_valid() then
                if whitelist then
                        local ipnum = task:get_from_ip():to_number()
                        if whitelist:get_key(ipnum) then
index 4ad8766f567e1b31df07d1e11919e41112984cfb..8b094aa80999358287db0196b4f9fbd3b38f8715 100644 (file)
@@ -24,12 +24,12 @@ local function check_multimap(task)
                if rule['type'] == 'ip' then
                        if rule['cdb'] then
                                local ip = task:get_from_ip()
-                               if ip and rule['hash']:lookup(ip) then
+                               if ip:is_valid() and rule['hash']:lookup(ip) then
                                        task:insert_result(rule['symbol'], 1)
                                end
                        else
                                local ip = task:get_from_ip():to_number()
-                               if ip and rule['ips'] and rule['ips']:get_key(ip) then
+                               if ip:is_valid() and rule['ips'] and rule['ips']:get_key(ip) then
                                        task:insert_result(rule['symbol'], 1)
                                end
                        end
@@ -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:to_string() ~= "0.0.0.0" then
+                       if ip:is_valid() 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'])