mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +03:00
Refactoring: renames Rule to RuleWithOperator
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "modsecurity/audit_log.h"
|
||||
|
||||
using modsecurity::audit_log::AuditLog;
|
||||
using modsecurity::Rule;
|
||||
using modsecurity::RuleWithOperator;
|
||||
|
||||
namespace modsecurity {
|
||||
namespace Parser {
|
||||
@@ -53,7 +53,7 @@ int Driver::addSecMarker(std::string marker, std::unique_ptr<std::string> fileNa
|
||||
}
|
||||
|
||||
|
||||
int Driver::addSecAction(std::unique_ptr<Rule> rule) {
|
||||
int Driver::addSecAction(std::unique_ptr<RuleWithOperator> rule) {
|
||||
if (rule->getPhase() >= modsecurity::Phases::NUMBER_OF_PHASES) {
|
||||
m_parserError << "Unknown phase: " << std::to_string(rule->getPhase());
|
||||
m_parserError << std::endl;
|
||||
@@ -72,7 +72,7 @@ int Driver::addSecRuleScript(std::unique_ptr<RuleScript> rule) {
|
||||
}
|
||||
|
||||
|
||||
int Driver::addSecRule(std::unique_ptr<Rule> r) {
|
||||
int Driver::addSecRule(std::unique_ptr<RuleWithOperator> r) {
|
||||
if (r->getPhase() >= modsecurity::Phases::NUMBER_OF_PHASES) {
|
||||
m_parserError << "Unknown phase: " << std::to_string(r->getPhase());
|
||||
m_parserError << std::endl;
|
||||
@@ -93,7 +93,7 @@ int Driver::addSecRule(std::unique_ptr<Rule> r) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<Rule> rule(std::move(r));
|
||||
std::shared_ptr<RuleWithOperator> rule(std::move(r));
|
||||
/*
|
||||
* Checking if the rule has an ID and also checking if this ID is not used
|
||||
* by other rule
|
||||
@@ -108,7 +108,7 @@ int Driver::addSecRule(std::unique_ptr<Rule> r) {
|
||||
for (int i = 0; i < modsecurity::Phases::NUMBER_OF_PHASES; i++) {
|
||||
Rules *rules = m_rulesSetPhases[i];
|
||||
for (int j = 0; j < rules->size(); j++) {
|
||||
Rule *lr = dynamic_cast<Rule *>(rules->at(j).get());
|
||||
RuleWithOperator *lr = dynamic_cast<RuleWithOperator *>(rules->at(j).get());
|
||||
if (lr && lr->m_ruleId == rule->m_ruleId) {
|
||||
m_parserError << "Rule id: " << std::to_string(rule->m_ruleId) \
|
||||
<< " is duplicated" << std::endl;
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "src/parser/seclang-parser.hh"
|
||||
#endif
|
||||
|
||||
using modsecurity::Rule;
|
||||
using modsecurity::RuleWithOperator;
|
||||
using modsecurity::RulesSet;
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ class Driver : public RulesSetProperties {
|
||||
Driver();
|
||||
virtual ~Driver();
|
||||
|
||||
int addSecRule(std::unique_ptr<Rule> rule);
|
||||
int addSecAction(std::unique_ptr<Rule> rule);
|
||||
int addSecRule(std::unique_ptr<RuleWithOperator> rule);
|
||||
int addSecAction(std::unique_ptr<RuleWithOperator> rule);
|
||||
int addSecMarker(std::string marker, std::unique_ptr<std::string> fileName, int lineNumber);
|
||||
int addSecRuleScript(std::unique_ptr<RuleScript> rule);
|
||||
|
||||
@@ -89,7 +89,7 @@ class Driver : public RulesSetProperties {
|
||||
std::list<yy::location *> loc;
|
||||
|
||||
std::string buffer;
|
||||
Rule *m_lastRule;
|
||||
RuleWithOperator *m_lastRule;
|
||||
|
||||
RulesSetPhases m_rulesSetPhases;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -295,7 +295,6 @@ class Driver;
|
||||
#include "src/variables/session.h"
|
||||
#include "src/variables/status.h"
|
||||
|
||||
|
||||
using namespace modsecurity;
|
||||
using namespace modsecurity::variables;
|
||||
using namespace modsecurity::Utils;
|
||||
@@ -348,7 +347,7 @@ using namespace modsecurity::operators;
|
||||
a = std::move(c);
|
||||
|
||||
|
||||
#line 352 "seclang-parser.hh"
|
||||
#line 351 "seclang-parser.hh"
|
||||
|
||||
# include <cassert>
|
||||
# include <cstdlib> // std::abort
|
||||
@@ -482,7 +481,7 @@ using namespace modsecurity::operators;
|
||||
#endif
|
||||
|
||||
namespace yy {
|
||||
#line 486 "seclang-parser.hh"
|
||||
#line 485 "seclang-parser.hh"
|
||||
|
||||
|
||||
|
||||
@@ -8112,7 +8111,7 @@ switch (yytype)
|
||||
}
|
||||
|
||||
} // yy
|
||||
#line 8116 "seclang-parser.hh"
|
||||
#line 8115 "seclang-parser.hh"
|
||||
|
||||
|
||||
|
||||
|
@@ -257,7 +257,6 @@ class Driver;
|
||||
#include "src/variables/session.h"
|
||||
#include "src/variables/status.h"
|
||||
|
||||
|
||||
using namespace modsecurity;
|
||||
using namespace modsecurity::variables;
|
||||
using namespace modsecurity::Utils;
|
||||
@@ -1081,7 +1080,7 @@ expression:
|
||||
}
|
||||
|
||||
Operator *op = $3.release();
|
||||
std::unique_ptr<Rule> rule(new Rule(
|
||||
std::unique_ptr<RuleWithOperator> rule(new RuleWithOperator(
|
||||
/* op */ op,
|
||||
/* variables */ v,
|
||||
/* actions */ a,
|
||||
@@ -1101,7 +1100,7 @@ expression:
|
||||
v->push_back(i.release());
|
||||
}
|
||||
|
||||
std::unique_ptr<Rule> rule(new Rule(
|
||||
std::unique_ptr<RuleWithOperator> rule(new RuleWithOperator(
|
||||
/* op */ $3.release(),
|
||||
/* variables */ v,
|
||||
/* actions */ NULL,
|
||||
@@ -1124,7 +1123,7 @@ expression:
|
||||
a->push_back(i.release());
|
||||
}
|
||||
}
|
||||
std::unique_ptr<Rule> rule(new Rule(
|
||||
std::unique_ptr<RuleWithOperator> rule(new RuleWithOperator(
|
||||
/* op */ NULL,
|
||||
/* variables */ NULL,
|
||||
/* actions */ a,
|
||||
|
Reference in New Issue
Block a user