Adds support to the @streq operator

This commit is contained in:
Felipe Zimmerle 2015-07-27 16:12:04 -03:00
parent 35901c1ebe
commit 170cb60c82
2 changed files with 10 additions and 12 deletions

View File

@ -21,19 +21,15 @@ namespace ModSecurity {
namespace operators {
bool StrEq::evaluate(Assay *assay, const std::string &str) {
/**
* @todo Implement the operator StrEq.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#streq
*/
return !this->param.compare(str);
bool eq = !this->param.compare(str);
if (negation) {
return !eq;
}
return eq;
}
StrEq::StrEq(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@ -30,7 +30,9 @@ namespace operators {
class StrEq : public Operator {
public:
/** @ingroup ModSecurity_Operator */
StrEq(std::string o, std::string p, bool i);
StrEq(std::string op, std::string param, bool negation)
: Operator(op, param, negation) { }
bool evaluate(Assay *assay, const std::string &str) override;
};