mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-01 06:09:03 +03:00
Removes unecessary static methods from regex class
This commit is contained in:
@@ -127,7 +127,7 @@ std::unique_ptr<std::string> AnchoredSetVariable::resolveFirst(
|
||||
void AnchoredSetVariable::resolveRegularExpression(regex::Regex *r,
|
||||
std::vector<const VariableValue *> *l) {
|
||||
for (const auto& x : *this) {
|
||||
int ret = regex::regex_search(x.first, *r);
|
||||
int ret = r->search(x.first);
|
||||
if (ret <= 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ void AnchoredSetVariable::resolveRegularExpression(regex::Regex *r,
|
||||
std::vector<const VariableValue *> *l,
|
||||
Variables::KeyExclusions &ke) {
|
||||
for (const auto& x : *this) {
|
||||
int ret = regex::regex_search(x.first, *r);
|
||||
int ret = r->search(x.first);
|
||||
if (ret <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -279,8 +279,7 @@ bool AuditLog::isRelevant(int status) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return regex::regex_search(sstatus,
|
||||
regex::Regex(m_relevant)) != 0;
|
||||
return regex::Regex(m_relevant).search(sstatus) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ void InMemoryPerProcess::resolveRegularExpression(const std::string& var,
|
||||
//}
|
||||
//std::string content = std::string(x.first, keySize + 1,
|
||||
// x.first.size() - keySize - 1);
|
||||
int ret = regex::regex_search(x.first, r);
|
||||
int ret = r.search(x.first);
|
||||
if (ret <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ void LMDB::resolveRegularExpression(const std::string& var,
|
||||
|
||||
while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
|
||||
char *a = reinterpret_cast<char *>(key.mv_data);
|
||||
int ret = regex::regex_search(a, r);
|
||||
int ret = r.search(a);
|
||||
if (ret <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
namespace modsecurity {
|
||||
using regex::RegexMatch;
|
||||
using regex::regex_search;
|
||||
using regex::Regex;
|
||||
|
||||
namespace operators {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
namespace modsecurity {
|
||||
using regex::RegexMatch;
|
||||
using regex::regex_search;
|
||||
using regex::Regex;
|
||||
|
||||
namespace operators {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
namespace modsecurity {
|
||||
using regex::RegexMatch;
|
||||
using regex::regex_search;
|
||||
using regex::Regex;
|
||||
|
||||
namespace operators {
|
||||
|
||||
@@ -69,16 +69,6 @@ class Regex {
|
||||
};
|
||||
|
||||
|
||||
static inline int regex_search(const std::string& s, RegexMatch *match, const Regex& regex) {
|
||||
return regex.search(s, match);
|
||||
}
|
||||
|
||||
|
||||
static inline int regex_search(const std::string& s, const Regex& regex) {
|
||||
return regex.search(s);
|
||||
}
|
||||
|
||||
|
||||
} // namespace regex
|
||||
} // namespace modsecurity
|
||||
|
||||
|
||||
@@ -198,23 +198,23 @@ class Rule_DictElementRegexp : public VariableRegex {
|
||||
void evaluate(Transaction *t,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
if (regex::regex_search("id", m_r) > 0) {
|
||||
if (m_r.search("id") > 0) {
|
||||
Rule_DictElement::id(t, rule, l);
|
||||
return;
|
||||
}
|
||||
if (regex::regex_search("rev", m_r) > 0) {
|
||||
if (m_r.search("rev") > 0) {
|
||||
Rule_DictElement::rev(t, rule, l);
|
||||
return;
|
||||
}
|
||||
if (regex::regex_search("severity", m_r) > 0) {
|
||||
if (m_r.search("severity") > 0) {
|
||||
Rule_DictElement::severity(t, rule, l);
|
||||
return;
|
||||
}
|
||||
if (regex::regex_search("logdata", m_r) > 0) {
|
||||
if (m_r.search("logdata") > 0) {
|
||||
Rule_DictElement::logData(t, rule, l);
|
||||
return;
|
||||
}
|
||||
if (regex::regex_search("msg", m_r) > 0) {
|
||||
if (m_r.search("msg") > 0) {
|
||||
Rule_DictElement::msg(t, rule, l);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user