local current_line = ""
local line_num = 0
- for line in f:lines() do
+ for raw_line in f:lines() do
line_num = line_num + 1
-- Strip trailing whitespace
- line = line:gsub('%s+$', '')
+ local line = raw_line:gsub('%s+$', '')
-- Handle line continuation
if line:match('\\$') then
-- Split targets by comma
local target_list = {}
- for target in targets:gmatch('[^,]+') do
- target = target:gsub('^%s+', ''):gsub('%s+$', '') -- Trim
+ for raw_target in targets:gmatch('[^,]+') do
+ local target = raw_target:gsub('^%s+', ''):gsub('%s+$', '') -- Trim
-- Skip special targets for now (:include:, |program, /file)
if not target:match('^:include:') and
converted.whitelist = wl
end
- for k, v in value:pairs() do
+ for opt, v in value:pairs() do
+ local k = opt
local skip = false
-- Rename
if k == 'suffix' then
converted.whitelist = wl
end
- for k, v in value:pairs() do
+ for opt, v in value:pairs() do
+ local k = opt
local skip = false
-- Rename
if k == 'dnsbl' then
local symbol_section = v:at('symbol')
if symbol_section and symbol_section:type() == 'object' then
for sk, sv in symbol_section:pairs() do
+ local sym_name = sk
if sv:type() == 'object' and sv:at('name') then
- sk = sv:at('name'):unwrap()
+ sym_name = sv:at('name'):unwrap()
sv.name = nil -- Remove field
end
- new_group.symbols[sk] = sv
+ new_group.symbols[sym_name] = sv
end
end
end
local result = {}
for k, v in pairs(elts) do
- k = k:lower()
- if k ~= "v" then
- v = v:lower()
+ local key = k:lower()
+ local value = v
+ if key ~= "v" then
+ value = v:lower()
end
- result[k] = v
+ result[key] = value
end
return result
-- Select traverse function depending on what we have
local iter_func = settings.extra_columns[1] and ipairs or pairs
- for col_name, col_data in iter_func(settings.extra_columns) do
+ for col_key, col_data in iter_func(settings.extra_columns) do
-- Array based extra columns
- if col_data.name then
- col_name = col_data.name
- end
+ local col_name = col_data.name or col_key
if not col_data.selector or not col_data.type then
rspamd_logger.errx(rspamd_config, 'cannot add clickhouse extra row %s: no type or no selector',
col_name)
local skip_to_endif = false
local if_nested = 0
- for l in f:lines() do
- (function()
+ for raw_l in f:lines() do
+ (function(l)
l = lua_util.rspamd_str_trim(l)
-- Replace bla=~/re/ with bla =~ /re/ (#2372)
l = l:gsub('([^%s])%s*([=!]~)%s*([^%s])', '%1 %2 %3')
end,
fun.drop_n(1, words))
end
- end)()
+ end)(raw_l)
end
if valid_rule then
insert_cur_rule()
local skip_to_endif = false
local if_nested = 0
- for l in f:lines() do
- (function ()
+ for raw_l in f:lines() do
+ (function (l)
l = lua_util.rspamd_str_trim(l)
-- Replace bla=~/re/ with bla =~ /re/ (#2372)
l = l:gsub('([^%s])%s*([=!]~)%s*([^%s])', '%1 %2 %3')
table.insert(complicated, l)
return
end
- end)()
+ end)(raw_l)
end
if valid_rule then
insert_cur_rule()