File tree Expand file tree Collapse file tree 8 files changed +17
-17
lines changed Expand file tree Collapse file tree 8 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,9 @@ using Tags = std::vector<actions::Tag *>;
6666using SetVars = std::vector<actions::SetVar *>;
6767using MatchActions = std::vector<actions::Action *>;
6868
69- class RuleBase {
69+ class Rule {
7070 public:
71- RuleBase (std::unique_ptr<std::string> fileName, int lineNumber)
71+ Rule (std::unique_ptr<std::string> fileName, int lineNumber)
7272 : m_fileName(std::move(fileName)),
7373 m_lineNumber (lineNumber),
7474 m_phase(modsecurity::Phases::RequestHeadersPhase) {
@@ -103,13 +103,13 @@ class RuleBase {
103103};
104104
105105
106- class RuleMarker : public RuleBase {
106+ class RuleMarker : public Rule {
107107 public:
108108 RuleMarker (
109109 const std::string &name,
110110 std::unique_ptr<std::string> fileName,
111111 int lineNumber)
112- : RuleBase (std::move(fileName), lineNumber),
112+ : Rule (std::move(fileName), lineNumber),
113113 m_name (std::make_shared<std::string>(name)) { }
114114
115115
@@ -139,7 +139,7 @@ class RuleMarker : public RuleBase {
139139};
140140
141141
142- class RuleWithActions : public RuleBase {
142+ class RuleWithActions : public Rule {
143143 public:
144144 RuleWithActions (
145145 Actions *a,
Original file line number Diff line number Diff line change @@ -61,11 +61,11 @@ class Rules {
6161 return j;
6262 }
6363
64- bool insert (std::shared_ptr<RuleBase > rule) {
64+ bool insert (std::shared_ptr<Rule > rule) {
6565 return insert (rule, nullptr , nullptr );
6666 }
6767
68- bool insert (std::shared_ptr<RuleBase > rule, const std::vector<int64_t > *ids, std::ostringstream *err) {
68+ bool insert (std::shared_ptr<Rule > rule, const std::vector<int64_t > *ids, std::ostringstream *err) {
6969 RuleWithOperator *r = dynamic_cast <RuleWithOperator *>(rule.get ());
7070 if (r && ids != nullptr && std::binary_search (ids->begin (), ids->end (), r->m_ruleId )) {
7171 if (err != nullptr ) {
@@ -79,10 +79,10 @@ class Rules {
7979 }
8080
8181 size_t size () const { return m_rules.size (); }
82- std::shared_ptr<RuleBase > operator [](int index) const { return m_rules[index]; }
83- std::shared_ptr<RuleBase > at (int index) const { return m_rules[index]; }
82+ std::shared_ptr<Rule > operator [](int index) const { return m_rules[index]; }
83+ std::shared_ptr<Rule > at (int index) const { return m_rules[index]; }
8484
85- std::vector<std::shared_ptr<RuleBase > > m_rules;
85+ std::vector<std::shared_ptr<Rule > > m_rules;
8686};
8787
8888
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class Driver;
4343class RulesSetPhases {
4444 public:
4545
46- bool insert (std::shared_ptr<RuleBase > rule);
46+ bool insert (std::shared_ptr<Rule > rule);
4747
4848 int append (RulesSetPhases *from, std::ostringstream *err);
4949 void dump () const ;
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ RuleWithActions::RuleWithActions(
5757 Transformations *transformations,
5858 std::unique_ptr<std::string> fileName,
5959 int lineNumber)
60- : RuleBase (std::move(fileName), lineNumber),
60+ : Rule (std::move(fileName), lineNumber),
6161 m_rev (" " ),
6262 m_ver(" " ),
6363 m_accuracy(0 ),
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ int RulesSet::evaluate(int phase, Transaction *t) {
135135 for (int i = 0 ; i < rules->size (); i++) {
136136 // FIXME: This is not meant to be here. At the end of this refactoring,
137137 // the shared pointer won't be used.
138- std::shared_ptr<RuleBase > rule = rules->at (i);
138+ std::shared_ptr<Rule > rule = rules->at (i);
139139 if (t->isInsideAMarker () && !rule->isMarker ()) {
140140 ms_dbg_a (t, 9 , " Skipped rule id '" + rule->getReference () \
141141 + " ' due to a SecMarker: " + *t->getCurrentMarker ());
@@ -152,7 +152,7 @@ int RulesSet::evaluate(int phase, Transaction *t) {
152152 ms_dbg_a (t, 9 , " Skipped rule id '" + rule->getReference () \
153153 + " ' as request trough the utilization of an `allow' action." );
154154 } else {
155- RuleBase *base = rule.get ();
155+ Rule *base = rule.get ();
156156 RuleWithOperator *ruleWithOperator = dynamic_cast <RuleWithOperator *>(base);
157157 if (m_exceptions.contains (ruleWithOperator->m_ruleId )) {
158158 ms_dbg_a (t, 9 , " Skipped rule id '" + rule->getReference () \
Original file line number Diff line number Diff line change 2929namespace modsecurity {
3030
3131
32- bool RulesSetPhases::insert (std::shared_ptr<RuleBase > rule) {
32+ bool RulesSetPhases::insert (std::shared_ptr<Rule > rule) {
3333 if (rule->getPhase () >= modsecurity::Phases::NUMBER_OF_PHASES) {
3434 return false ;
3535 }
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ std::string RunTimeString::evaluate(Transaction *t) {
5151}
5252
5353
54- std::string RunTimeString::evaluate (Transaction *t, RuleBase *r) {
54+ std::string RunTimeString::evaluate (Transaction *t, Rule *r) {
5555 std::string s;
5656 for (auto &z : m_elements) {
5757 if (z->m_string .size () > 0 ) {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class RunTimeString {
4949 void appendText (const std::string &text);
5050 void appendVar (std::unique_ptr<modsecurity::variables::Variable> var);
5151 std::string evaluate (Transaction *t);
52- std::string evaluate (Transaction *t, RuleBase *r);
52+ std::string evaluate (Transaction *t, Rule *r);
5353 std::string evaluate () {
5454 return evaluate (NULL );
5555 }
You can’t perform that action at this time.
0 commit comments