Adds support to the operator ge

This commit is contained in:
Felipe Zimmerle 2015-07-27 16:07:39 -03:00
parent 4462fd84ec
commit 35901c1ebe
2 changed files with 11 additions and 15 deletions

View File

@ -22,22 +22,16 @@
namespace ModSecurity {
namespace operators {
bool Ge::evaluate(Assay *assay) {
/**
* @todo Implement the operator Ge.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#ge
*/
bool Ge::evaluate(Assay *assay, const std::string &input) {
bool ge = atoll(input.c_str()) >= atoll(param.c_str());
return true;
if (negation) {
return !ge;
}
return ge;
}
Ge::Ge(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@ -27,8 +27,10 @@ namespace operators {
class Ge : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Ge(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
Ge(std::string op, std::string param, bool negation)
: Operator(op, param, negation) { }
bool evaluate(Assay *assay, const std::string &input) override;
};
} // namespace operators