diff --git a/src/operators/lt.cc b/src/operators/lt.cc index f0bf08d5..fb8de468 100644 --- a/src/operators/lt.cc +++ b/src/operators/lt.cc @@ -22,20 +22,16 @@ namespace ModSecurity { namespace operators { -bool Lt::evaluate(Assay *assay) { - /** - * @todo Implement the operator Lt. - * Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#lt - */ - return true; +bool Lt::evaluate(Assay *assay, const std::string &input) { + bool lt = atoll(input.c_str()) < atoll(param.c_str()); + + if (negation) { + return !lt; + } + + return lt; } -Lt::Lt(std::string op, std::string param, bool negation) - : Operator() { - this->op = op; - this->param = param; -} - } // namespace operators } // namespace ModSecurity diff --git a/src/operators/lt.h b/src/operators/lt.h index 50d04051..6da8c3d5 100644 --- a/src/operators/lt.h +++ b/src/operators/lt.h @@ -27,8 +27,10 @@ namespace operators { class Lt : public Operator { public: /** @ingroup ModSecurity_Operator */ - Lt(std::string o, std::string p, bool i); - bool evaluate(Assay *assay); + Lt(std::string op, std::string param, bool negation) + : Operator(op, param, negation) { } + + bool evaluate(Assay *assay, const std::string &input) override; }; } // namespace operators