Adds support to @ipMatch operator

This commit is contained in:
Felipe Zimmerle
2015-07-30 20:57:23 -03:00
parent bf0169b528
commit f811ec6518
8 changed files with 1402 additions and 14 deletions

View File

@@ -15,29 +15,32 @@
#include "operators/ip_match.h"
#include <string.h>
#include <string>
#include "utils/msc_tree.h"
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool IpMatch::evaluate(Assay *assay) {
/**
* @todo Implement the operator IpMatch.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#ipmatch
*/
return true;
bool IpMatch::init(const char **error) {
std::string e("");
bool res = m_tree.addFromBuffer(param, &e);
if (res == false) {
*error = e.c_str();
}
return res;
}
IpMatch::IpMatch(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
bool IpMatch::evaluate(Assay *assay, const std::string &input) {
return m_tree.contains(input);
}
} // namespace operators
} // namespace ModSecurity