mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Refactoring: how to report to error logs
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "src/operators/operator.h"
|
||||
#include "src/utils/acmp.h"
|
||||
#include "src/utils/string.h"
|
||||
|
||||
namespace modsecurity {
|
||||
namespace operators {
|
||||
@@ -78,15 +79,6 @@ void Pm::postOrderTraversal(acmp_btree_node_t *node) {
|
||||
node = NULL;
|
||||
}
|
||||
|
||||
void Pm::replaceAll(std::string str, const std::string& from,
|
||||
const std::string& to) {
|
||||
size_t start_pos = 0;
|
||||
while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
|
||||
size_t end_pos = start_pos + from.length();
|
||||
str.replace(start_pos, end_pos, to);
|
||||
start_pos += to.length();
|
||||
}
|
||||
}
|
||||
|
||||
bool Pm::evaluate(Transaction *transaction, Rule *rule,
|
||||
const std::string &input) {
|
||||
@@ -119,8 +111,6 @@ bool Pm::init(const std::string &file, std::string *error) {
|
||||
std::istringstream *iss;
|
||||
const char *err = NULL;
|
||||
|
||||
replaceAll(m_param, "\\", "\\\\");
|
||||
|
||||
char *content = parse_pm_content(m_param.c_str(), m_param.length(), &err);
|
||||
if (content == NULL) {
|
||||
iss = new std::istringstream(m_param);
|
||||
|
@@ -35,8 +35,6 @@ class Pm : public Operator {
|
||||
m_p = acmp_create(0);
|
||||
}
|
||||
~Pm();
|
||||
void replaceAll(std::string str, const std::string& from,
|
||||
const std::string& to);
|
||||
bool evaluate(Transaction *transaction, Rule *rule,
|
||||
const std::string &input) override;
|
||||
bool evaluate(Transaction *transaction,
|
||||
|
Reference in New Issue
Block a user