diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-03-29 16:16:37 -0700 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-03-29 16:16:37 -0700 |
commit | 53baa1a9af473dde1e64f82510fede7ca1c12292 (patch) | |
tree | e7e39d0dfa3f6ca50841d1c6509d106437c9e089 | |
parent | 673e601426bd19638ab74a85b2fcc01a00b7cb1a (diff) | |
download | rspamd-53baa1a9af473dde1e64f82510fede7ca1c12292.tar.gz rspamd-53baa1a9af473dde1e64f82510fede7ca1c12292.zip |
Update plugins.
-rw-r--r-- | src/plugins/lua/ip_score.lua | 10 | ||||
-rw-r--r-- | src/plugins/lua/multimap.lua | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index ab8258a89..ebec5252a 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -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 diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 4ad8766f5..8b094aa80 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -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']) |