aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-25 15:37:38 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-25 15:37:38 +0000
commit221a576077cb7ae2b11bb954230bef583d384fc4 (patch)
tree7583ad880c56e67beefb57a60c52956547f4c81d /src/plugins
parentd8833f06bd6272520a4d6994b54c0df43ca3c6f0 (diff)
downloadrspamd-221a576077cb7ae2b11bb954230bef583d384fc4.tar.gz
rspamd-221a576077cb7ae2b11bb954230bef583d384fc4.zip
[Fix] Multimap: Fix operating with userdata
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/multimap.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 8f1061e4f..9eda5aeec 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -404,14 +404,16 @@ local function multimap_callback(task, rule)
if r['cdb'] then
local srch = value
if type(value) == 'userdata' then
- srch = value:to_string()
+ if value.class == 'rspamd{ip}' then
+ srch = value:tostring()
+ end
end
ret = r['cdb']:lookup(srch)
elseif r['redis_key'] then
local srch = {value}
local cmd = 'HGET'
- if type(value) == 'userdata' then
- srch = {value:to_string()}
+ if type(value) == 'userdata' and value.class == 'rspamd{ip}' then
+ srch = {value:tostring()}
cmd = 'HMGET'
local maxbits = 128
local minbits = 32
@@ -420,7 +422,7 @@ local function multimap_callback(task, rule)
minbits = 8
end
for i=maxbits,minbits,-1 do
- local nip = value:apply_mask(i):to_string() .. "/" .. i
+ local nip = value:apply_mask(i):tostring() .. "/" .. i
table.insert(srch, nip)
end
end
@@ -440,7 +442,9 @@ local function multimap_callback(task, rule)
ret = r['radix']:get_key(value)
elseif r['hash'] then
if type(value) == 'userdata' then
- value = value:to_string()
+ if value.class == 'rspamd{ip}' then
+ value = value:tostring()
+ end
end
ret = r['hash']:get_key(value)
end