mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +03:00
Creates RuleUnconditional
Makes RuleScript child of RuleWithActions instead of Operator
This commit is contained in:
@@ -54,7 +54,7 @@ int Driver::addSecMarker(std::string marker, std::unique_ptr<std::string> fileNa
|
||||
}
|
||||
|
||||
|
||||
int Driver::addSecAction(std::unique_ptr<RuleWithOperator> rule) {
|
||||
int Driver::addSecAction(std::unique_ptr<RuleWithActions> rule) {
|
||||
if (rule->getPhase() >= modsecurity::Phases::NUMBER_OF_PHASES) {
|
||||
m_parserError << "Unknown phase: " << std::to_string(rule->getPhase());
|
||||
m_parserError << std::endl;
|
||||
@@ -73,7 +73,7 @@ int Driver::addSecRuleScript(std::unique_ptr<RuleScript> rule) {
|
||||
}
|
||||
|
||||
|
||||
int Driver::addSecRule(std::unique_ptr<RuleWithOperator> r) {
|
||||
int Driver::addSecRule(std::unique_ptr<RuleWithActions> r) {
|
||||
if (r->getPhase() >= modsecurity::Phases::NUMBER_OF_PHASES) {
|
||||
m_parserError << "Unknown phase: " << std::to_string(r->getPhase());
|
||||
m_parserError << std::endl;
|
||||
@@ -94,7 +94,7 @@ int Driver::addSecRule(std::unique_ptr<RuleWithOperator> r) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<RuleWithOperator> rule(std::move(r));
|
||||
std::shared_ptr<RuleWithActions> rule(std::move(r));
|
||||
/*
|
||||
* Checking if the rule has an ID and also checking if this ID is not used
|
||||
* by other rule
|
||||
|
@@ -66,8 +66,8 @@ class Driver : public RulesSetProperties {
|
||||
Driver();
|
||||
virtual ~Driver();
|
||||
|
||||
int addSecRule(std::unique_ptr<RuleWithOperator> rule);
|
||||
int addSecAction(std::unique_ptr<RuleWithOperator> rule);
|
||||
int addSecRule(std::unique_ptr<RuleWithActions> rule);
|
||||
int addSecAction(std::unique_ptr<RuleWithActions> 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;
|
||||
RuleWithOperator *m_lastRule;
|
||||
RuleWithActions *m_lastRule;
|
||||
|
||||
RulesSetPhases m_rulesSetPhases;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -55,6 +55,7 @@ class Driver;
|
||||
}
|
||||
}
|
||||
|
||||
#include "modsecurity/rule_unconditional.h"
|
||||
#include "src/rule_script.h"
|
||||
|
||||
#include "src/actions/accuracy.h"
|
||||
@@ -347,7 +348,7 @@ using namespace modsecurity::operators;
|
||||
a = std::move(c);
|
||||
|
||||
|
||||
#line 351 "seclang-parser.hh"
|
||||
#line 352 "seclang-parser.hh"
|
||||
|
||||
# include <cassert>
|
||||
# include <cstdlib> // std::abort
|
||||
@@ -481,7 +482,7 @@ using namespace modsecurity::operators;
|
||||
#endif
|
||||
|
||||
namespace yy {
|
||||
#line 485 "seclang-parser.hh"
|
||||
#line 486 "seclang-parser.hh"
|
||||
|
||||
|
||||
|
||||
@@ -8111,7 +8112,7 @@ switch (yytype)
|
||||
}
|
||||
|
||||
} // yy
|
||||
#line 8115 "seclang-parser.hh"
|
||||
#line 8116 "seclang-parser.hh"
|
||||
|
||||
|
||||
|
||||
|
@@ -17,6 +17,7 @@ class Driver;
|
||||
}
|
||||
}
|
||||
|
||||
#include "modsecurity/rule_unconditional.h"
|
||||
#include "src/rule_script.h"
|
||||
|
||||
#include "src/actions/accuracy.h"
|
||||
@@ -1123,9 +1124,7 @@ expression:
|
||||
a->push_back(i.release());
|
||||
}
|
||||
}
|
||||
std::unique_ptr<RuleWithOperator> rule(new RuleWithOperator(
|
||||
/* op */ NULL,
|
||||
/* variables */ NULL,
|
||||
std::unique_ptr<RuleUnconditional> rule(new RuleUnconditional(
|
||||
/* actions */ a,
|
||||
/* transformations */ t,
|
||||
/* file name */ std::unique_ptr<std::string>(new std::string(*@1.end.filename)),
|
||||
|
Reference in New Issue
Block a user