Revert "Adds suppor for HyperScan in the bulid system"

This reverts commit 912704b6d4.
This commit is contained in:
Felipe Zimmerle
2021-02-26 11:33:12 -03:00
parent a496865e96
commit 4cdcc15334
16 changed files with 23 additions and 291 deletions

View File

@@ -25,23 +25,14 @@
#include <list>
#include <memory>
#ifdef WITH_HS
#include <hs.h>
#endif
#include "src/operators/operator.h"
#ifndef WITH_HS
#include "src/utils/acmp.h"
#endif
#include "src/utils/string.h"
namespace modsecurity {
namespace operators {
Pm::~Pm() {
#ifdef WITH_HS
#else
acmp_node_t *root = m_p->root_node;
cleanup(root);
@@ -51,10 +42,9 @@ Pm::~Pm() {
#ifdef MODSEC_MUTEX_ON_PM
pthread_mutex_destroy(&m_lock);
#endif
#endif
}
#ifndef WITH_HS
void Pm::cleanup(acmp_node_t *n) {
if (n == NULL) {
return;
@@ -77,9 +67,8 @@ void Pm::cleanup(acmp_node_t *n) {
free(n);
}
#endif
#ifndef WITH_HS
void Pm::postOrderTraversal(acmp_btree_node_t *node) {
if (node == NULL) {
return;
@@ -90,14 +79,10 @@ void Pm::postOrderTraversal(acmp_btree_node_t *node) {
free(node);
}
#endif
bool Pm::evaluate(Transaction *transaction, RuleWithActions *rule,
const std::string &input, std::shared_ptr<RuleMessage> ruleMessage) {
#ifdef WITH_HS
return 0;
#else
int rc;
ACMPT pt;
pt.parser = m_p;
@@ -125,16 +110,10 @@ bool Pm::evaluate(Transaction *transaction, RuleWithActions *rule,
}
return rc >= 0;
#endif
return 0;
}
bool Pm::init(const std::string &file, std::string *error) {
#ifdef WITH_HS
fprintf(stdout, "Sopport for HS is on the way: %s\n", hs_version());
#else
std::vector<std::string> vec;
std::istringstream *iss;
const char *err = NULL;
@@ -167,7 +146,7 @@ bool Pm::init(const std::string &file, std::string *error) {
}
delete iss;
#endif
return true;
}

View File

@@ -34,17 +34,11 @@ class Pm : public Operator {
/** @ingroup ModSecurity_Operator */
explicit Pm(std::unique_ptr<RunTimeString> param)
: Operator("Pm", std::move(param)) {
#ifdef WITH_HS
#else
m_p = acmp_create(0);
#endif
}
explicit Pm(const std::string &n, std::unique_ptr<RunTimeString> param)
: Operator(n, std::move(param)) {
#ifdef WITH_HS
#else
m_p = acmp_create(0);
#endif
}
~Pm();
bool evaluate(Transaction *transaction, RuleWithActions *rule,
@@ -53,23 +47,17 @@ class Pm : public Operator {
bool init(const std::string &file, std::string *error) override;
#ifndef WITH_HS
void postOrderTraversal(acmp_btree_node_t *node);
void cleanup(acmp_node_t *n);
#endif
protected:
#ifndef WITH_HS
ACMP *m_p;
#endif
#ifdef MODSEC_MUTEX_ON_PM
private:
#ifndef WITH_HS
#ifdef MODSEC_MUTEX_ON_PM
pthread_mutex_t m_lock;
#endif
#endif
};

View File

@@ -68,18 +68,13 @@ bool PmFromFile::init(const std::string &config, std::string *error) {
for (std::string line; std::getline(*iss, line); ) {
if (isComment(line) == false) {
#ifdef WITH_HS
#else
acmp_add_pattern(m_p, line.c_str(), NULL, NULL, line.length());
#endif
}
}
#ifndef WITH_HS
while (m_p->is_failtree_done == 0) {
acmp_prepare(m_p);
}
#endif
delete iss;
return true;