mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 03:57:47 +03:00
Refactoring: renames Rule to RuleWithOperator
This commit is contained in:
21
src/rule.cc
21
src/rule.cc
@@ -384,7 +384,7 @@ std::string RuleWithActions::msg(Transaction *t) { return m_msg->data(t); }
|
||||
int RuleWithActions::severity() const { return m_severity->m_severity; }
|
||||
|
||||
|
||||
Rule::Rule(Operator *op,
|
||||
RuleWithOperator::RuleWithOperator(Operator *op,
|
||||
variables::Variables *_variables,
|
||||
std::vector<Action *> *actions,
|
||||
Transformations *transformations,
|
||||
@@ -399,7 +399,7 @@ Rule::Rule(Operator *op,
|
||||
m_unconditional(false) { /* */ }
|
||||
|
||||
|
||||
Rule::~Rule() {
|
||||
RuleWithOperator::~RuleWithOperator() {
|
||||
if (m_operator != NULL) {
|
||||
delete m_operator;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ Rule::~Rule() {
|
||||
}
|
||||
|
||||
|
||||
void Rule::updateMatchedVars(Transaction *trans, const std::string &key,
|
||||
void RuleWithOperator::updateMatchedVars(Transaction *trans, const std::string &key,
|
||||
const std::string &value) {
|
||||
ms_dbg_a(trans, 9, "Matched vars updated.");
|
||||
trans->m_variableMatchedVar.set(value, trans->m_variableOffset);
|
||||
@@ -427,7 +427,7 @@ void Rule::updateMatchedVars(Transaction *trans, const std::string &key,
|
||||
}
|
||||
|
||||
|
||||
void Rule::cleanMatchedVars(Transaction *trans) {
|
||||
void RuleWithOperator::cleanMatchedVars(Transaction *trans) {
|
||||
ms_dbg_a(trans, 9, "Matched vars cleaned.");
|
||||
trans->m_variableMatchedVar.unset();
|
||||
trans->m_variableMatchedVars.unset();
|
||||
@@ -436,7 +436,8 @@ void Rule::cleanMatchedVars(Transaction *trans) {
|
||||
}
|
||||
|
||||
|
||||
bool Rule::executeOperatorAt(Transaction *trans, const std::string &key,
|
||||
|
||||
bool RuleWithOperator::executeOperatorAt(Transaction *trans, const std::string &key,
|
||||
std::string value, std::shared_ptr<RuleMessage> ruleMessage) {
|
||||
#if MSC_EXEC_CLOCK_ENABLED
|
||||
clock_t begin = clock();
|
||||
@@ -465,7 +466,7 @@ bool Rule::executeOperatorAt(Transaction *trans, const std::string &key,
|
||||
}
|
||||
|
||||
|
||||
void Rule::getVariablesExceptions(Transaction *t,
|
||||
void RuleWithOperator::getVariablesExceptions(Transaction *t,
|
||||
variables::Variables *exclusion, variables::Variables *addition) {
|
||||
for (auto &a : t->m_rules->m_exceptions.m_variable_update_target_by_tag) {
|
||||
if (containsTag(*a.first.get(), t) == false) {
|
||||
@@ -511,10 +512,9 @@ void Rule::getVariablesExceptions(Transaction *t,
|
||||
}
|
||||
|
||||
|
||||
inline void Rule::getFinalVars(variables::Variables *vars,
|
||||
inline void RuleWithOperator::getFinalVars(variables::Variables *vars,
|
||||
variables::Variables *exclusion, Transaction *trans) {
|
||||
variables::Variables addition;
|
||||
|
||||
getVariablesExceptions(trans, exclusion, &addition);
|
||||
|
||||
for (int i = 0; i < m_variables->size(); i++) {
|
||||
@@ -578,7 +578,7 @@ void RuleWithActions::executeAction(Transaction *trans,
|
||||
}
|
||||
|
||||
|
||||
bool Rule::evaluate(Transaction *trans,
|
||||
bool RuleWithOperator::evaluate(Transaction *trans,
|
||||
std::shared_ptr<RuleMessage> ruleMessage) {
|
||||
bool globalRet = false;
|
||||
variables::Variables *variables = this->m_variables;
|
||||
@@ -812,6 +812,7 @@ std::vector<actions::Action *> RuleWithActions::getActionsByName(const std::stri
|
||||
}
|
||||
|
||||
|
||||
std::string Rule::getOperatorName() const { return m_operator->m_op; }
|
||||
std::string RuleWithOperator::getOperatorName() const { return m_operator->m_op; }
|
||||
|
||||
|
||||
} // namespace modsecurity
|
||||
|
Reference in New Issue
Block a user