diff --git a/src/operators/gt.cc b/src/operators/gt.cc index c56a1d2f..e9eda697 100644 --- a/src/operators/gt.cc +++ b/src/operators/gt.cc @@ -22,21 +22,16 @@ namespace ModSecurity { namespace operators { -bool Gt::evaluate(Assay *assay) { - /** - * @todo Implement the operator Gt. - * Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#gt - */ - return true; +bool Gt::evaluate(Assay *assay, const std::string &input) { + bool gt = atoll(input.c_str()) > atoll(param.c_str()); + + if (negation) { + return !gt; + } + + return gt; } -Gt::Gt(std::string op, std::string param, - bool negation) - : Operator() { - this->op = op; - this->param = param; -} - } // namespace operators } // namespace ModSecurity diff --git a/src/operators/gt.h b/src/operators/gt.h index 001d3629..3b2a3620 100644 --- a/src/operators/gt.h +++ b/src/operators/gt.h @@ -27,8 +27,10 @@ namespace operators { class Gt : public Operator { public: /** @ingroup ModSecurity_Operator */ - Gt(std::string o, std::string p, bool i); - bool evaluate(Assay *assay); + Gt(std::string op, std::string param, bool negation) + : Operator(op, param, negation) { } + + bool evaluate(Assay *assay, const std::string &input) override; }; } // namespace operators