Fix the init method signature in some operators

This commit is contained in:
Felipe Zimmerle 2015-10-20 13:23:08 -03:00
parent 4a5e6b3e57
commit 90c74beca1
6 changed files with 9 additions and 8 deletions

View File

@ -25,8 +25,9 @@ namespace operators {
bool Ge::evaluate(Assay *assay, const std::string &input) { bool Ge::evaluate(Assay *assay, const std::string &input) {
std::string p = MacroExpansion::expand(param, assay); 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) { if (negation) {
return !ge; return !ge;

View File

@ -28,7 +28,7 @@ class InspectFile : public Operator {
public: public:
/** @ingroup ModSecurity_Operator */ /** @ingroup ModSecurity_Operator */
InspectFile(std::string o, std::string p, bool i); InspectFile(std::string o, std::string p, bool i);
bool evaluate(Assay *assay); bool evaluate(Assay *assay) override;
}; };
} // namespace operators } // namespace operators

View File

@ -25,7 +25,7 @@ namespace ModSecurity {
namespace operators { namespace operators {
bool IpMatch::init(const char **error) { bool IpMatch::init(const std::string &file, const char **error) {
std::string e(""); std::string e("");
bool res = m_tree.addFromBuffer(param, &e); bool res = m_tree.addFromBuffer(param, &e);

View File

@ -31,9 +31,9 @@ class IpMatch : public Operator {
IpMatch(std::string op, std::string param, bool negation) IpMatch(std::string op, std::string param, bool negation)
: Operator(op, param, 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: protected:
Utils::IpTree m_tree; Utils::IpTree m_tree;

View File

@ -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<std::string> vec; std::vector<std::string> vec;
replaceAll(param, "\\", "\\\\"); replaceAll(param, "\\", "\\\\");

View File

@ -37,9 +37,9 @@ class Pm : public Operator {
~Pm(); ~Pm();
void replaceAll(std::string str, const std::string& from, void replaceAll(std::string str, const std::string& from,
const std::string& to); 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); void postOrderTraversal(acmp_btree_node_t *node);
std::list<std::string> matched; std::list<std::string> matched;