mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Adds support to the strmatch operator
This commit is contained in:
parent
f62e17c67c
commit
70c2621af3
@ -22,20 +22,17 @@
|
|||||||
namespace ModSecurity {
|
namespace ModSecurity {
|
||||||
namespace operators {
|
namespace operators {
|
||||||
|
|
||||||
bool StrMatch::evaluate(Assay *assay) {
|
|
||||||
/**
|
bool StrMatch::evaluate(Assay *assay, const std::string &input) {
|
||||||
* @todo Implement the operator StrMatch.
|
bool ret = input.find(param) != std::string::npos;
|
||||||
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#strmatch
|
|
||||||
*/
|
if (negation) {
|
||||||
return true;
|
return !ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StrMatch::StrMatch(std::string op, std::string param, bool negation)
|
|
||||||
: Operator() {
|
|
||||||
this->op = op;
|
|
||||||
this->param = param;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace operators
|
} // namespace operators
|
||||||
} // namespace ModSecurity
|
} // namespace ModSecurity
|
||||||
|
@ -27,8 +27,10 @@ namespace operators {
|
|||||||
class StrMatch : public Operator {
|
class StrMatch : public Operator {
|
||||||
public:
|
public:
|
||||||
/** @ingroup ModSecurity_Operator */
|
/** @ingroup ModSecurity_Operator */
|
||||||
StrMatch(std::string o, std::string p, bool i);
|
StrMatch(std::string op, std::string param, bool negation)
|
||||||
bool evaluate(Assay *assay);
|
: Operator(op, param, negation) { }
|
||||||
|
|
||||||
|
bool evaluate(Assay *assay, const std::string &input) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace operators
|
} // namespace operators
|
||||||
|
Loading…
x
Reference in New Issue
Block a user