mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 18:30:35 +03:00
Having a better organization for Variables::
This commit is contained in:
@@ -29,50 +29,8 @@ namespace modsecurity {
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class ArgsPost_DictElement : public Variable {
|
||||
public:
|
||||
explicit ArgsPost_DictElement(std::string dictElement)
|
||||
: Variable("ARGS_POST" + std::string(":") + std::string(dictElement)),
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
transaction->m_variableArgsPost.resolve(m_dictElement, l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
};
|
||||
|
||||
|
||||
class ArgsPost_NoDictElement : public Variable {
|
||||
public:
|
||||
ArgsPost_NoDictElement()
|
||||
: Variable("ARGS_POST") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
transaction->m_variableArgsPost.resolve(l, m_keyExclusion);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ArgsPost_DictElementRegexp : public Variable {
|
||||
public:
|
||||
explicit ArgsPost_DictElementRegexp(std::string dictElement)
|
||||
: Variable("ARGS_POST:regex(" + dictElement + ")"),
|
||||
m_r(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
transaction->m_variableArgsPost.resolveRegularExpression(&m_r, l,
|
||||
m_keyExclusion);
|
||||
}
|
||||
|
||||
Utils::Regex m_r;
|
||||
};
|
||||
DEFINE_VARIABLE_DICT(ArgsPost, ARGS_POST, m_variableArgsPost)
|
||||
|
||||
|
||||
} // namespace Variables
|
||||
|
||||
Reference in New Issue
Block a user