mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-28 19:00:48 +00:00
cleanup: restore the name of a variable
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com> Co-authored-by: Luca Guerra <luca.guerra@sysdig.com>
This commit is contained in:
parent
e601ec2eab
commit
a6a1a9769f
@ -435,12 +435,12 @@ static void read_item(
|
||||
rule_loader::context ctx(item, rule_loader::context::LIST, name, parent);
|
||||
rule_loader::list_info v(ctx);
|
||||
|
||||
bool has_append_flag = false;
|
||||
bool append = false;
|
||||
decode_val(item, "list", v.name, ctx);
|
||||
decode_items(item, v.items, ctx);
|
||||
|
||||
decode_optional_val(item, "append", has_append_flag, ctx);
|
||||
if(has_append_flag)
|
||||
decode_optional_val(item, "append", append, ctx);
|
||||
if(append)
|
||||
{
|
||||
cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx);
|
||||
}
|
||||
@ -450,13 +450,13 @@ static void read_item(
|
||||
decode_overrides(item, overridable, overridable, override_append, override_replace, ctx);
|
||||
bool has_overrides = !override_append.empty() || !override_replace.empty();
|
||||
|
||||
THROW(has_append_flag && has_overrides, ERROR_OVERRIDE_APPEND, ctx);
|
||||
THROW(append && has_overrides, ERROR_OVERRIDE_APPEND, ctx);
|
||||
|
||||
// Since a list only has items, if we have chosen to append them we can append the entire object
|
||||
// otherwise we just want to redefine the list.
|
||||
has_append_flag |= override_append.find("items") != override_append.end();
|
||||
append |= override_append.find("items") != override_append.end();
|
||||
|
||||
if(has_append_flag)
|
||||
if(append)
|
||||
{
|
||||
collector.append(cfg, v);
|
||||
}
|
||||
@ -476,14 +476,14 @@ static void read_item(
|
||||
rule_loader::macro_info v(ctx);
|
||||
v.name = name;
|
||||
|
||||
bool has_append_flag = false;
|
||||
bool append = false;
|
||||
decode_val(item, "condition", v.cond, ctx);
|
||||
|
||||
// Now set the proper context for the condition now that we know it exists
|
||||
v.cond_ctx = rule_loader::context(item["condition"], rule_loader::context::MACRO_CONDITION, "", ctx);
|
||||
|
||||
decode_optional_val(item, "append", has_append_flag, ctx);
|
||||
if(has_append_flag)
|
||||
decode_optional_val(item, "append", append, ctx);
|
||||
if(append)
|
||||
{
|
||||
cfg.res->add_warning(falco::load_result::LOAD_DEPRECATED_ITEM, WARNING_APPEND, ctx);
|
||||
}
|
||||
@ -493,13 +493,13 @@ static void read_item(
|
||||
decode_overrides(item, overridable, overridable, override_append, override_replace, ctx);
|
||||
bool has_overrides = !override_append.empty() || !override_replace.empty();
|
||||
|
||||
THROW((has_append_flag && has_overrides), ERROR_OVERRIDE_APPEND, ctx);
|
||||
THROW((append && has_overrides), ERROR_OVERRIDE_APPEND, ctx);
|
||||
|
||||
// Since a macro only has a condition, if we have chosen to append to it we can append the entire object
|
||||
// otherwise we just want to redefine the macro.
|
||||
has_append_flag |= override_append.find("condition") != override_append.end();
|
||||
append |= override_append.find("condition") != override_append.end();
|
||||
|
||||
if(has_append_flag)
|
||||
if(append)
|
||||
{
|
||||
collector.append(cfg, v);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user