actions: Compute the rule association during rules load

This commit is contained in:
Felipe Zimmerle
2020-05-18 15:08:17 -03:00
parent a4cd7a0091
commit 2ee9ccffa9
83 changed files with 842 additions and 415 deletions

View File

@@ -30,7 +30,7 @@ namespace operators {
bool Rx::init(const std::string &file, std::string *error) {
if (m_string->m_containsMacro == false) {
if (m_string->containsMacro() == false) {
m_re = new Regex(m_param);
}
@@ -44,11 +44,11 @@ bool Rx::evaluate(Transaction *transaction,
RuleMessage *ruleMessage) {
Regex *re;
if (m_param.empty() && !m_string->m_containsMacro) {
if (m_param.empty() && !m_string->containsMacro()) {
return true;
}
if (m_string->m_containsMacro) {
if (m_string->containsMacro()) {
std::string eparam(m_string->evaluate(transaction));
re = new Regex(eparam);
} else {
@@ -73,12 +73,12 @@ bool Rx::evaluate(Transaction *transaction,
logOffset(ruleMessage, capture.m_offset, capture.m_length);
}
if (!captures.empty()) {
return true;
if (m_string->containsMacro()) {
delete re;
}
if (m_string->m_containsMacro) {
delete re;
if (!captures.empty()) {
return true;
}
return false;