Fix geolookup operator instantiation

This commit is contained in:
Felipe Zimmerle 2015-08-10 17:59:09 -03:00
parent 64cbb15335
commit c5a4355348

View File

@ -59,7 +59,7 @@
#include "operators/begins_with.h"
#define IF_MATCH(a) \
if (op.compare(1, op.length() - 2, #a) == 0)
if (op_ == #a)
namespace ModSecurity {
namespace operators {
@ -125,6 +125,11 @@ Operator *Operator::instantiate(std::string op_string) {
p != op.end(); ++p) {
*p = tolower(*p);
}
std::string op_ = op;
if (op_.length() > 2) {
op_.erase(0, 1);
op_.pop_back();
}
IF_MATCH(beginswith) { return new BeginsWith(op, param, negation); }
IF_MATCH(contains) { return new Contains(op, param, negation); }
@ -134,7 +139,7 @@ Operator *Operator::instantiate(std::string op_string) {
IF_MATCH(endswith) { return new EndsWith(op, param, negation); }
IF_MATCH(eq) { return new Eq(op, param, negation); }
IF_MATCH(fuzzyhash) { return new FuzzyHash(op, param, negation); }
IF_MATCH(geolookup) { return new GeoLookup(op, param, negation); }
IF_MATCH(geolooku) { return new GeoLookup(op, param, negation); }
IF_MATCH(ge) { return new Ge(op, param, negation); }
IF_MATCH(gsblookup) { return new GsbLookup(op, param, negation); }
IF_MATCH(gt) { return new Gt(op, param, negation); }