aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2015-02-15 22:25:57 +0200
committerAndrew Lewis <nerf@judo.za.org>2015-02-15 22:25:57 +0200
commit3fd3a8e6b708401ca14204f0ab71501c08f16d78 (patch)
tree537fdc07e44c7ec76162689ace8a5ab69849de36
parent15702a351be151d16f8f0c8eb2bf48595b434484 (diff)
downloadrspamd-3fd3a8e6b708401ca14204f0ab71501c08f16d78.tar.gz
rspamd-3fd3a8e6b708401ca14204f0ab71501c08f16d78.zip
Don't use to_number() when checking radix maps
-rw-r--r--src/plugins/lua/ip_score.lua6
-rw-r--r--src/plugins/lua/multimap.lua2
2 files changed, 3 insertions, 5 deletions
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