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 *>;
66
66
using SetVars = std::vector<actions::SetVar *>;
67
67
using MatchActions = std::vector<actions::Action *>;
68
68
69
- class RuleBase {
69
+ class Rule {
70
70
public:
71
- RuleBase (std::unique_ptr<std::string> fileName, int lineNumber)
71
+ Rule (std::unique_ptr<std::string> fileName, int lineNumber)
72
72
: m_fileName(std::move(fileName)),
73
73
m_lineNumber (lineNumber),
74
74
m_phase(modsecurity::Phases::RequestHeadersPhase) {
@@ -103,13 +103,13 @@ class RuleBase {
103
103
};
104
104
105
105
106
- class RuleMarker : public RuleBase {
106
+ class RuleMarker : public Rule {
107
107
public:
108
108
RuleMarker (
109
109
const std::string &name,
110
110
std::unique_ptr<std::string> fileName,
111
111
int lineNumber)
112
- : RuleBase (std::move(fileName), lineNumber),
112
+ : Rule (std::move(fileName), lineNumber),
113
113
m_name (std::make_shared<std::string>(name)) { }
114
114
115
115
@@ -139,7 +139,7 @@ class RuleMarker : public RuleBase {
139
139
};
140
140
141
141
142
- class RuleWithActions : public RuleBase {
142
+ class RuleWithActions : public Rule {
143
143
public:
144
144
RuleWithActions (
145
145
Actions *a,
Original file line number Diff line number Diff line change @@ -61,11 +61,11 @@ class Rules {
61
61
return j;
62
62
}
63
63
64
- bool insert (std::shared_ptr<RuleBase > rule) {
64
+ bool insert (std::shared_ptr<Rule > rule) {
65
65
return insert (rule, nullptr , nullptr );
66
66
}
67
67
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) {
69
69
RuleWithOperator *r = dynamic_cast <RuleWithOperator *>(rule.get ());
70
70
if (r && ids != nullptr && std::binary_search (ids->begin (), ids->end (), r->m_ruleId )) {
71
71
if (err != nullptr ) {
@@ -79,10 +79,10 @@ class Rules {
79
79
}
80
80
81
81
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]; }
84
84
85
- std::vector<std::shared_ptr<RuleBase > > m_rules;
85
+ std::vector<std::shared_ptr<Rule > > m_rules;
86
86
};
87
87
88
88
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class Driver;
43
43
class RulesSetPhases {
44
44
public:
45
45
46
- bool insert (std::shared_ptr<RuleBase > rule);
46
+ bool insert (std::shared_ptr<Rule > rule);
47
47
48
48
int append (RulesSetPhases *from, std::ostringstream *err);
49
49
void dump () const ;
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ RuleWithActions::RuleWithActions(
57
57
Transformations *transformations,
58
58
std::unique_ptr<std::string> fileName,
59
59
int lineNumber)
60
- : RuleBase (std::move(fileName), lineNumber),
60
+ : Rule (std::move(fileName), lineNumber),
61
61
m_rev (" " ),
62
62
m_ver(" " ),
63
63
m_accuracy(0 ),
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ int RulesSet::evaluate(int phase, Transaction *t) {
135
135
for (int i = 0 ; i < rules->size (); i++) {
136
136
// FIXME: This is not meant to be here. At the end of this refactoring,
137
137
// 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);
139
139
if (t->isInsideAMarker () && !rule->isMarker ()) {
140
140
ms_dbg_a (t, 9 , " Skipped rule id '" + rule->getReference () \
141
141
+ " ' due to a SecMarker: " + *t->getCurrentMarker ());
@@ -152,7 +152,7 @@ int RulesSet::evaluate(int phase, Transaction *t) {
152
152
ms_dbg_a (t, 9 , " Skipped rule id '" + rule->getReference () \
153
153
+ " ' as request trough the utilization of an `allow' action." );
154
154
} else {
155
- RuleBase *base = rule.get ();
155
+ Rule *base = rule.get ();
156
156
RuleWithOperator *ruleWithOperator = dynamic_cast <RuleWithOperator *>(base);
157
157
if (m_exceptions.contains (ruleWithOperator->m_ruleId )) {
158
158
ms_dbg_a (t, 9 , " Skipped rule id '" + rule->getReference () \
Original file line number Diff line number Diff line change 29
29
namespace modsecurity {
30
30
31
31
32
- bool RulesSetPhases::insert (std::shared_ptr<RuleBase > rule) {
32
+ bool RulesSetPhases::insert (std::shared_ptr<Rule > rule) {
33
33
if (rule->getPhase () >= modsecurity::Phases::NUMBER_OF_PHASES) {
34
34
return false ;
35
35
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ std::string RunTimeString::evaluate(Transaction *t) {
51
51
}
52
52
53
53
54
- std::string RunTimeString::evaluate (Transaction *t, RuleBase *r) {
54
+ std::string RunTimeString::evaluate (Transaction *t, Rule *r) {
55
55
std::string s;
56
56
for (auto &z : m_elements) {
57
57
if (z->m_string .size () > 0 ) {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class RunTimeString {
49
49
void appendText (const std::string &text);
50
50
void appendVar (std::unique_ptr<modsecurity::variables::Variable> var);
51
51
std::string evaluate (Transaction *t);
52
- std::string evaluate (Transaction *t, RuleBase *r);
52
+ std::string evaluate (Transaction *t, Rule *r);
53
53
std::string evaluate () {
54
54
return evaluate (NULL );
55
55
}
You can’t perform that action at this time.
0 commit comments