From 069657a0d0f29d1aa471237c2d1228959d46f3f2 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 29 Mar 2014 16:16:37 -0700 Subject: [PATCH] Update plugins. --- src/plugins/lua/ip_score.lua | 10 +++++----- 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']) -- 2.39.5