From 90c74beca1544dc7c3b0364f9f078b4bd767d01b Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Tue, 20 Oct 2015 13:23:08 -0300 Subject: [PATCH] Fix the init method signature in some operators --- src/operators/ge.cc | 3 ++- src/operators/inspect_file.h | 2 +- src/operators/ip_match.cc | 2 +- src/operators/ip_match.h | 4 ++-- src/operators/pm.cc | 2 +- src/operators/pm.h | 4 ++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/operators/ge.cc b/src/operators/ge.cc index 5f41a4ac..6fa54fd2 100644 --- a/src/operators/ge.cc +++ b/src/operators/ge.cc @@ -25,8 +25,9 @@ namespace operators { bool Ge::evaluate(Assay *assay, const std::string &input) { std::string p = MacroExpansion::expand(param, assay); + std::string i = MacroExpansion::expand(input, assay); - bool ge = atoll(p.c_str()) >= atoll(p.c_str()); + bool ge = atoll(i.c_str()) >= atoll(p.c_str()); if (negation) { return !ge; diff --git a/src/operators/inspect_file.h b/src/operators/inspect_file.h index c7baa978..b55a3b0b 100644 --- a/src/operators/inspect_file.h +++ b/src/operators/inspect_file.h @@ -28,7 +28,7 @@ class InspectFile : public Operator { public: /** @ingroup ModSecurity_Operator */ InspectFile(std::string o, std::string p, bool i); - bool evaluate(Assay *assay); + bool evaluate(Assay *assay) override; }; } // namespace operators diff --git a/src/operators/ip_match.cc b/src/operators/ip_match.cc index 2342f73c..b3b55d02 100644 --- a/src/operators/ip_match.cc +++ b/src/operators/ip_match.cc @@ -25,7 +25,7 @@ namespace ModSecurity { namespace operators { -bool IpMatch::init(const char **error) { +bool IpMatch::init(const std::string &file, const char **error) { std::string e(""); bool res = m_tree.addFromBuffer(param, &e); diff --git a/src/operators/ip_match.h b/src/operators/ip_match.h index a7417882..cf8f13f9 100644 --- a/src/operators/ip_match.h +++ b/src/operators/ip_match.h @@ -31,9 +31,9 @@ class IpMatch : public Operator { IpMatch(std::string op, std::string param, bool negation) : Operator(op, param, negation) { } - bool evaluate(Assay *assay, const std::string &input); + bool evaluate(Assay *assay, const std::string &input) override; - virtual bool init(const char **error); + virtual bool init(const std::string &file, const char **error) override; protected: Utils::IpTree m_tree; diff --git a/src/operators/pm.cc b/src/operators/pm.cc index 689b53d8..b9649e49 100644 --- a/src/operators/pm.cc +++ b/src/operators/pm.cc @@ -85,7 +85,7 @@ bool Pm::evaluate(Assay *assay, const std::string &input) { } -bool Pm::init(const char **error) { +bool Pm::init(const std::string &file, const char **error) { std::vector vec; replaceAll(param, "\\", "\\\\"); diff --git a/src/operators/pm.h b/src/operators/pm.h index 3140078d..c824ad31 100644 --- a/src/operators/pm.h +++ b/src/operators/pm.h @@ -37,9 +37,9 @@ class Pm : public Operator { ~Pm(); void replaceAll(std::string str, const std::string& from, const std::string& to); - bool evaluate(Assay *assay, const std::string &input); + bool evaluate(Assay *assay, const std::string &input) override; - virtual bool init(const char **error); + virtual bool init(const std::string &file, const char **error) override; void postOrderTraversal(acmp_btree_node_t *node); std::list matched;