mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds support to @ipMatch operator
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user