mirror of
https://github.com/falcosecurity/falco.git
synced 2025-06-26 14:52:20 +00:00
replace .. with table concat
Signed-off-by: vadim.zyarko <vadim.zyarko@sysdig.com>
This commit is contained in:
parent
c86615f68c
commit
b88a1cbb09
@ -293,18 +293,18 @@ function split_lines(rules_content)
|
||||
end
|
||||
|
||||
function get_orig_yaml_obj(rules_lines, row)
|
||||
local ret = ""
|
||||
|
||||
idx = row
|
||||
local t = {}
|
||||
while (idx <= #rules_lines) do
|
||||
ret = ret..rules_lines[idx].."\n"
|
||||
t[#t + 1] = rules_lines[idx]
|
||||
idx = idx + 1
|
||||
|
||||
if idx > #rules_lines or rules_lines[idx] == "" or string.sub(rules_lines[idx], 1, 1) == '-' then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local ret = ""
|
||||
ret = table.concat(t, "\n")
|
||||
return ret
|
||||
end
|
||||
|
||||
@ -757,23 +757,26 @@ function build_exception_condition_string_multi_fields(eitem, exfields)
|
||||
local fields = eitem['fields']
|
||||
local comps = eitem['comps']
|
||||
|
||||
local icond = "("
|
||||
local icond = {}
|
||||
|
||||
icond[#icond + 1] = "("
|
||||
|
||||
local lcount = 0
|
||||
for i, values in ipairs(eitem['values']) do
|
||||
|
||||
if #fields ~= #values then
|
||||
return nil, "Exception item " .. eitem['name'] .. ": fields and values lists must have equal length"
|
||||
end
|
||||
|
||||
if icond ~= "(" then
|
||||
icond=icond.." or "
|
||||
if lcount ~= 0 then
|
||||
icond[#icond + 1] = " or "
|
||||
end
|
||||
lcount = lcount + 1
|
||||
|
||||
icond=icond.."("
|
||||
icond[#icond + 1] = "("
|
||||
|
||||
for k = 1, #fields do
|
||||
if k > 1 then
|
||||
icond=icond.." and "
|
||||
icond[#icond + 1] = " and "
|
||||
end
|
||||
local ival = values[k]
|
||||
local istr = ""
|
||||
@ -798,21 +801,22 @@ function build_exception_condition_string_multi_fields(eitem, exfields)
|
||||
end
|
||||
end
|
||||
|
||||
icond = icond..fields[k].." "..comps[k].." "..istr
|
||||
icond[#icond + 1] = fields[k] .. " " .. comps[k] .. " " .. istr
|
||||
exfields[fields[k]] = true
|
||||
end
|
||||
|
||||
icond=icond..")"
|
||||
icond[#icond + 1] = ")"
|
||||
end
|
||||
|
||||
icond = icond..")"
|
||||
icond[#icond + 1] = ")"
|
||||
|
||||
-- Don't return a trivially empty condition string
|
||||
if icond == "()" then
|
||||
icond = ""
|
||||
local ret = table.concat(icond)
|
||||
if ret == "()" then
|
||||
return "", nil
|
||||
end
|
||||
|
||||
return icond, nil
|
||||
return ret, nil
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user