From: Andrew Lewis Date: Sun, 15 Feb 2015 20:25:57 +0000 (+0200) Subject: Don't use to_number() when checking radix maps X-Git-Tag: 0.8.2~42^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59e46cd2ffac6b0ccfb02d2415f09fce4ff251e0;p=rspamd.git Don't use to_number() when checking radix maps --- diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index 1ba267dce..6da59c3ed 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -68,8 +68,7 @@ local ip_score_set = function(task) if action then -- Check whitelist if whitelist then - local ipnum = task:get_from_ip():to_number() - if task:get_from_ip():is_valid() and whitelist:get_key(ipnum) then + if task:get_from_ip():is_valid() and whitelist:get_key(task:get_from_ip()) then -- Address is whitelisted return end @@ -131,8 +130,7 @@ local ip_score_check = function(task) local ip = task:get_from_ip() if ip:is_valid() then if whitelist then - local ipnum = task:get_from_ip():to_number() - if whitelist:get_key(ipnum) then + if whitelist:get_key(task:get_from_ip()) then -- Address is whitelisted return end diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 0a809ca52..6af38a40c 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -57,7 +57,7 @@ local function check_multimap(task) end else local ip = task:get_from_ip() - if ip:is_valid() and rule['ips'] and rule['ips']:get_key(ip:to_number()) then + if ip:is_valid() and rule['ips'] and rule['ips']:get_key(ip) then task:insert_result(rule['symbol'], 1) end end