Using direct variable access instead m_collections

This commit is contained in:
Felipe Zimmerle
2018-01-28 02:31:11 -03:00
parent 43bba3f942
commit 6f7fdd9493
17 changed files with 247 additions and 447 deletions

View File

@@ -33,7 +33,8 @@ bool LogData::evaluate(Rule *rule, Transaction *transaction,
std::shared_ptr<RuleMessage> rm) {
rm->m_data = data(transaction);
transaction->m_collections.storeOrUpdateFirst("RULE:logdata", rm->m_data);
transaction->m_variableRule.set("logdata", rm->m_data, 0);
return true;
}

View File

@@ -54,7 +54,7 @@ bool Msg::evaluate(Rule *rule, Transaction *transaction,
transaction->debug(9, "Saving msg: " + msg);
#endif
transaction->m_collections.storeOrUpdateFirst("RULE:msg", msg);
transaction->m_variableRule.set("msg", msg, 0);
return true;
}

View File

@@ -79,8 +79,21 @@ bool SetVar::evaluate(Rule *rule, Transaction *t) {
} else if (m_operation == setToOneOperation) {
targetValue = std::string("1");
} else if (m_operation == unsetOperation) {
t->m_collections.del(m_variable->m_collectionName + ":" +
m_variableNameExpanded);
if (tx) {
tx->del(t, m_variableNameExpanded);
} else if (session) {
session->del(t, m_variableNameExpanded);
} else if (ip) {
ip->del(t, m_variableNameExpanded);
} else if (resource) {
resource->del(t, m_variableNameExpanded);
} else if (global) {
global->del(t, m_variableNameExpanded);
} else if (user) {
user->del(t, m_variableNameExpanded);
} else {
// ?
}
goto end;
} else {
int pre = 0;
@@ -118,9 +131,26 @@ bool SetVar::evaluate(Rule *rule, Transaction *t) {
t->debug(8, "Saving variable: " + m_variable->m_collectionName \
+ ":" + m_variableNameExpanded + " with value: " + targetValue);
#endif
if (tx) {
tx->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue);
} else if (session) {
session->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue);
} else if (ip) {
ip->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue);
} else if (resource) {
resource->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue);
} else if (global) {
global->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue);
} else if (user) {
user->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue);
} else {
// ?
}
/*
t->m_collections.storeOrUpdateFirst(m_variable->m_collectionName,
m_variableNameExpanded,
t->m_rules->m_secWebAppId.m_value, targetValue);
*/
end:
return true;
}

View File

@@ -84,8 +84,8 @@ bool Severity::evaluate(Rule *rule, Transaction *transaction,
transaction->m_highestSeverityAction = this->m_severity;
}
transaction->m_collections.storeOrUpdateFirst("RULE:severity",
std::to_string(m_severity));
transaction->m_variableRule.set("severity", std::to_string(m_severity), 0);
return true;
}