Makes re2 detectable by the build scripts

This commit is contained in:
Felipe Zimmerle
2019-01-18 18:59:04 -03:00
parent a5ee59f5d0
commit 22136788c8
13 changed files with 310 additions and 28 deletions

View File

@@ -316,7 +316,8 @@ libmodsecurity_la_CPPFLAGS = \
$(SSDEEP_CFLAGS) \
$(MAXMIND_CFLAGS) \
$(LUA_CFLAGS) \
$(LIBXML2_CFLAGS)
$(LIBXML2_CFLAGS) \
$(RE2_CFLAGS)
libmodsecurity_la_LDFLAGS = \
@@ -331,6 +332,7 @@ libmodsecurity_la_LDFLAGS = \
$(SSDEEP_LDFLAGS) \
$(MAXMIND_LDFLAGS) \
$(YAJL_LDFLAGS) \
$(RE2_LDFLAGS) \
-version-info @MSC_VERSION_INFO@
@@ -346,5 +348,6 @@ libmodsecurity_la_LIBADD = \
$(PCRE_LDADD) \
$(MAXMIND_LDADD) \
$(SSDEEP_LDADD) \
$(YAJL_LDADD)
$(YAJL_LDADD) \
$(RE2_LDADD)

View File

@@ -26,7 +26,8 @@ libmodsec_parser_la_CPPFLAGS = \
$(YAJL_CFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE_CFLAGS) \
$(LIBXML2_CFLAGS)
$(LIBXML2_CFLAGS) \
$(RE2_CFLAGS)
test.cc: seclang-parser.hh
cat seclang-parser.hh | sed "s/return \*new (yyas_<T> ()) T (t)/return *new (yyas_<T> ()) T (std::move((T\&)t))/g" > seclang-parser.hh.fix && mv seclang-parser.hh.fix seclang-parser.hh

View File

@@ -18,7 +18,7 @@
#include <fstream>
#include <string>
#include <list>
#include <pcre.h>
#include "src/regex/backend/pcre.h"
#include "src/regex/regex_match.h"
@@ -28,6 +28,7 @@ namespace modsecurity {
namespace regex {
namespace backend {
#ifdef WITH_PCRE
#if PCRE_HAVE_JIT
#define pcre_study_opt PCRE_STUDY_JIT_COMPILE
@@ -119,6 +120,7 @@ int Pcre::search(const std::string& s) const {
s.size(), 0, 0, ovector, OVECCOUNT) > 0;
}
#endif
} // namespace backend
} // namespace regex

View File

@@ -13,7 +13,9 @@
*
*/
#ifdef WITH_PCRE
#include <pcre.h>
#endif
#include <iostream>
#include <fstream>
@@ -29,6 +31,7 @@ namespace modsecurity {
namespace regex {
namespace backend {
#ifdef WITH_PCRE
#define OVECCOUNT 30
@@ -52,6 +55,7 @@ class Pcre {
pcre_extra *m_pce = NULL;
};
#endif
} // namespace backend
} // namespace regex

View File

@@ -30,6 +30,14 @@
namespace modsecurity {
namespace regex {
#ifdef WITH_PCRE
using selectedBackend = backend::Pcre;
#elif WITH_RE2
//using selectedBackend = backend::Re2;
#else
#error "no regex backend selected"
#endif
using selectedBackend = backend::Pcre;
class Regex : public selectedBackend {