mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-07 01:30:13 +00:00
refactor(userspace/engine): remove source field from macros in rule loader
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
@@ -413,18 +413,6 @@ void rule_loader::append(configuration& cfg, list_info& info)
|
||||
|
||||
void rule_loader::define(configuration& cfg, macro_info& info)
|
||||
{
|
||||
if (!cfg.sources.at(info.source))
|
||||
{
|
||||
cfg.warnings.push_back("Macro " + info.name
|
||||
+ ": warning (unknown-source): unknown source "
|
||||
+ info.source + ", skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
auto prev = m_macro_infos.at(info.name);
|
||||
THROW(prev && prev->source != info.source,
|
||||
"Macro " + info.name + " has been re-defined with a different source");
|
||||
|
||||
define_info(m_macro_infos, info, m_cur_index++);
|
||||
}
|
||||
|
||||
@@ -566,7 +554,6 @@ void rule_loader::compile_macros_infos(
|
||||
indexed_vector<list_info>& lists,
|
||||
indexed_vector<macro_info>& out) const
|
||||
{
|
||||
set<string> used;
|
||||
const context* info_ctx = NULL;
|
||||
try
|
||||
{
|
||||
|
@@ -122,7 +122,6 @@ public:
|
||||
size_t visibility;
|
||||
std::string name;
|
||||
std::string cond;
|
||||
std::string source;
|
||||
std::shared_ptr<libsinsp::filter::ast::expr> cond_ast;
|
||||
};
|
||||
|
||||
|
@@ -207,12 +207,10 @@ static void read_item(
|
||||
rule_loader::macro_info v;
|
||||
v.ctx = ctx;
|
||||
bool append = false;
|
||||
v.source = falco_common::syscall_source;
|
||||
THROW(!decode_val(item["macro"], v.name) || v.name.empty(),
|
||||
"Macro name is empty");
|
||||
THROW(!decode_val(item["condition"], v.cond) || v.cond.empty(),
|
||||
"Macro must have property condition");
|
||||
decode_val(item["source"], v.source);
|
||||
if(decode_val(item["append"], append) && append)
|
||||
{
|
||||
loader.append(cfg, v);
|
||||
|
Reference in New Issue
Block a user