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,13 +24,18 @@ namespace modsecurity {
namespace operators {
bool EndsWith::evaluate(Transaction *transaction, const std::string &input) {
bool EndsWith::evaluate(Transaction *transaction, Rule *rule,
const std::string &input, RuleMessage *ruleMessage) {
bool ret = false;
std::string p = MacroExpansion::expand(m_param, transaction);
if (input.length() >= p.length()) {
ret = (0 == input.compare(input.length() - p.length(),
p.length(), p));
if (ret) {
logOffset(ruleMessage, input.length() - p.length(),
p.size());
}
}
return ret;