Adds first PoC for the operator offset feature

This commit is contained in:
Felipe Zimmerle
2017-01-19 14:34:48 -03:00
committed by Felipe Zimmerle
parent 9a8fc3116a
commit ecbf292f6d
89 changed files with 2908 additions and 105 deletions

View File

@@ -24,7 +24,8 @@ namespace modsecurity {
namespace operators {
bool BeginsWith::evaluate(Transaction *transaction, const std::string &str) {
bool BeginsWith::evaluate(Transaction *transaction, Rule *rule,
const std::string &str, RuleMessage *ruleMessage) {
bool ret = false;
std::string p = MacroExpansion::expand(m_param, transaction);
@@ -32,6 +33,7 @@ bool BeginsWith::evaluate(Transaction *transaction, const std::string &str) {
if (str.size() < p.size()) {
ret = false;
} else if (!str.compare(0, p.size(), p)) {
logOffset(ruleMessage, 0, p.size());
ret = true;
}