From: Philippe Antoine Date: Tue, 28 Sep 2021 10:10:10 +0000 (+0200) Subject: pcre2: remove PCRE1 as dependency X-Git-Tag: suricata-7.0.0-beta1~1340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6414%2Fhead;p=thirdparty%2Fsuricata.git pcre2: remove PCRE1 as dependency --- diff --git a/configure.ac b/configure.ac index ef3dc0917c..1ccbc5ac34 100644 --- a/configure.ac +++ b/configure.ac @@ -608,35 +608,6 @@ LIBS="${TMPLIBS} -lz" fi - #libpcre - AC_ARG_WITH(libpcre_includes, - [ --with-libpcre-includes=DIR libpcre include directory], - [with_libpcre_includes="$withval"],[with_libpcre_includes="no"]) - AC_ARG_WITH(libpcre_libraries, - [ --with-libpcre-libraries=DIR libpcre library directory], - [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"]) - - if test "$with_libpcre_includes" != "no"; then - CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}" - fi - AC_CHECK_HEADER(pcre.h,,[AC_MSG_ERROR(pcre.h not found ...)]) - - if test "$with_libpcre_libraries" != "no"; then - LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}" - fi - PCRE="" - AC_CHECK_LIB(pcre, pcre_get_substring,,PCRE="no") - if test "$PCRE" = "no"; then - echo - echo " ERROR! pcre library not found, go get it" - echo " from www.pcre.org. Or from packages:" - echo " Debian/Ubuntu: apt install libpcre3-dev" - echo " Fedora: dnf install pcre-devel" - echo " CentOS/RHEL: yum install pcre-devel" - echo - exit 1 - fi - PCRE2="" AC_CHECK_LIB(pcre2-8, pcre2_compile_8,,PCRE2="no") if test "$PCRE2" = "no"; then @@ -665,45 +636,6 @@ AC_MSG_RESULT(no) fi - # libpcre 8.35 (especially on debian) has a known issue that results in segfaults - # see https://redmine.openinfosecfoundation.org/issues/1693 - if test "$with_libpcre_libraries" = "no"; then - PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.35],[libpcre_buggy_found="yes"],[libprce_buggy_found="no"]) - if test "$libpcre_buggy_found" = "yes"; then - echo - echo " Warning! vulnerable libpcre version 8.35 found" - echo " This version has a known issue that could result in segfaults" - echo " please upgrade to a newer version of pcre which you can get from" - echo " www.pcre.org. For more information, see issue #1693" - echo - echo " Continuing for now with JIT disabled..." - echo - fi - fi - - # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work - # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful - PCRE="" - TMPLIBS="${LIBS}" - AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no") - if test "$PCRE" = "no"; then - echo - echo " ERROR! pcre library was found but version was < 6.0" - echo " please upgrade to a newer version of pcre which you can get from" - echo " www.pcre.org." - echo - exit 1 - fi - LIBS="${TMPLIBS}" - - TMPCFLAGS="${CFLAGS}" - CFLAGS="-O0 -g -Werror -Wall" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], - [[ pcre_extra *extra = NULL; pcre_free_study(extra); ]])], - [ AC_DEFINE([HAVE_PCRE_FREE_STUDY], [1], [Pcre pcre_free_study supported])],[:] - ) - CFLAGS="${TMPCFLAGS}" - # libhs enable_hyperscan="no" @@ -2616,7 +2548,7 @@ SURICATA_BUILD_CONF="Suricata Configuration: libjansson support: ${enable_jansson} hiredis support: ${enable_hiredis} hiredis async with libevent: ${enable_hiredis_async} - PCRE jit: ${pcre_jit_available} + PCRE jit: ${pcre2_jit_available} LUA support: ${enable_lua} libluajit: ${enable_luajit} GeoIP2 support: ${enable_geoip} diff --git a/doc/INSTALL.PF_RING b/doc/INSTALL.PF_RING index a5ce8c81b9..3d46d70254 100644 --- a/doc/INSTALL.PF_RING +++ b/doc/INSTALL.PF_RING @@ -8,7 +8,7 @@ apt-get install dkms apt-get install subversion flex bison #Install the debs needed for suricata. -apt-get install libpcre3-dev libpcap-dev libyaml-dev zlib1g-dev libcap-ng-dev libnet1-dev +apt-get install libpcap-dev libyaml-dev zlib1g-dev libcap-ng-dev libnet1-dev libpcre2-dev #In the exmple we will build from the GIT repo so we will need some extra packages apt-get install git-core automake autoconf libtool diff --git a/doc/INSTALL.WINDOWS b/doc/INSTALL.WINDOWS index f03bd37bfc..7b57790137 100644 --- a/doc/INSTALL.WINDOWS +++ b/doc/INSTALL.WINDOWS @@ -75,7 +75,7 @@ the following packages to c:\mingw (use newer versions if you like): - unpack to /msys/1.0 - don't forget to edit your ~/.gitconfig to at least give youreself a name :-) -5. Get libpcre +5. Get libpcre2 http://www.pcre.org/ @@ -117,7 +117,7 @@ the following packages to c:\mingw (use newer versions if you like): make If everything goes well, you'll end up with suricata.exe in src/.lib. To test it -you will need libpcre-0.dll, libz-1.dll, and pthreadGC2.dll which you already have somewhere +you will need libpcre2-0.dll, libz-1.dll, and pthreadGC2.dll which you already have somewhere under c:/mingw or c:/msys. To prepare the runtime environment: - copy the executable and the DLLs to a dedicated directory diff --git a/doc/userguide/install.rst b/doc/userguide/install.rst index 94662f4462..344ca05109 100644 --- a/doc/userguide/install.rst +++ b/doc/userguide/install.rst @@ -63,7 +63,7 @@ Dependencies For Suricata's compilation you'll need the following libraries and their development headers installed:: - libjansson, libpcap, libpcre, libmagic, zlib, libyaml + libjansson, libpcap, libpcre2, libmagic, zlib, libyaml The following tools are required:: @@ -87,17 +87,17 @@ Ubuntu/Debian Minimal:: - apt-get install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \ + apt-get install build-essential libpcap-dev \ libyaml-0-2 libyaml-dev pkg-config zlib1g zlib1g-dev \ - make libmagic-dev libjansson libjansson-dev + make libmagic-dev libjansson libjansson-dev libpcre2-dev Recommended:: - apt-get install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \ + apt-get install build-essential libpcap-dev \ libnet1-dev libyaml-0-2 libyaml-dev pkg-config zlib1g zlib1g-dev \ libcap-ng-dev libcap-ng0 make libmagic-dev \ libgeoip-dev liblua5.1-dev libhiredis-dev libevent-dev \ - python-yaml rustc cargo + python-yaml rustc cargo libpcre2-dev Extra for iptables/nftables IPS integration:: diff --git a/src/detect-engine-analyzer.c b/src/detect-engine-analyzer.c index 77000202c1..9298ba33cf 100644 --- a/src/detect-engine-analyzer.c +++ b/src/detect-engine-analyzer.c @@ -433,7 +433,7 @@ int PerCentEncodingSetup () #define DETECT_PERCENT_ENCODING_REGEX "%[0-9|a-f|A-F]{2}" int en; PCRE2_SIZE eo = 0; - int opts = 0; //PCRE_NEWLINE_ANY?? + int opts = 0; // PCRE2_NEWLINE_ANY?? percent_re = pcre2_compile((PCRE2_SPTR8)DETECT_PERCENT_ENCODING_REGEX, PCRE2_ZERO_TERMINATED, opts, &en, &eo, NULL); diff --git a/src/detect-pcre.c b/src/detect-pcre.c index 8746d9b50b..2286d03173 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -24,7 +24,6 @@ */ #include "suricata-common.h" -#include "pcre.h" #include "debug.h" #include "decode.h" #include "detect.h" diff --git a/src/suricata-common.h b/src/suricata-common.h index ed37bec946..98d73d2c47 100644 --- a/src/suricata-common.h +++ b/src/suricata-common.h @@ -138,7 +138,6 @@ typedef unsigned short u_short typedef unsigned char u_char #endif -#include #include #ifdef HAVE_SYSLOG_H @@ -365,10 +364,6 @@ typedef unsigned char u_char #error "byte order: can't figure out big or little" #endif -#ifndef HAVE_PCRE_FREE_STUDY -#define pcre_free_study pcre_free -#endif - #ifndef MIN #define MIN(x, y) (((x)<(y))?(x):(y)) #endif