aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-11-07 11:00:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-11-07 11:00:18 +0000
commit9691ba214d38cda7042ba902acd3c6e7231aa6b7 (patch)
tree4c41578d7fc9aa20c8be6d97dbb911eca73c0ba1 /src
parent6df7bb400aac3d07837971ded55f7cad45a9c939 (diff)
downloadrspamd-9691ba214d38cda7042ba902acd3c6e7231aa6b7.tar.gz
rspamd-9691ba214d38cda7042ba902acd3c6e7231aa6b7.zip
Fix multiple/single values in use settings.
Reported by: @citrin
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/settings.lua20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua
index c5c608f6d..6cab66855 100644
--- a/src/plugins/lua/settings.lua
+++ b/src/plugins/lua/settings.lua
@@ -178,7 +178,8 @@ local function process_settings_table(tbl)
local res = rspamd_ip.from_string(ip)
if res:is_valid() then
- table.insert(out, {res, 0})
+ out[1] = res
+ out[2] = 0
else
rspamd_logger.err("bad IP address: " .. ip)
return nil
@@ -188,7 +189,8 @@ local function process_settings_table(tbl)
local mask = tonumber(string.sub(ip, slash + 1))
if res:is_valid() then
- table.insert(out, {res, mask})
+ out[1] = res
+ out[2] = mask
else
rspamd_logger.err("bad IP address: " .. ip)
return nil
@@ -244,6 +246,13 @@ local function process_settings_table(tbl)
return out
end
+ local check_table = function(elt, out)
+ if type(elt) == 'string' then
+ return {out}
+ end
+
+ return out
+ end
local out = {}
@@ -251,21 +260,20 @@ local function process_settings_table(tbl)
local ip = process_ip(elt['ip'])
if ip then
- out['ip'] = ip
+ out['ip'] = check_table(elt['ip'], ip)
end
end
if elt['from'] then
local from = process_addr(elt['from'])
if from then
- out['from'] = from
+ out['from'] = check_table(elt['from'], from)
end
end
if elt['rcpt'] then
local rcpt = process_addr(elt['rcpt'])
-
if rcpt then
- out['rcpt'] = rcpt
+ out['rcpt'] = check_table(elt['rcpt'], rcpt)
end
end