]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcre2: remove PCRE1 as dependency 6414/head
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 28 Sep 2021 10:10:10 +0000 (12:10 +0200)
committerPhilippe Antoine <contact@catenacyber.fr>
Tue, 28 Sep 2021 15:46:19 +0000 (17:46 +0200)
configure.ac
doc/INSTALL.PF_RING
doc/INSTALL.WINDOWS
doc/userguide/install.rst
src/detect-engine-analyzer.c
src/detect-pcre.c
src/suricata-common.h

index ef3dc0917ceb3e60c0cd11d27261f7c7220f738b..1ccbc5ac343209d98d0b0e77fabc639ed074c1f6 100644 (file)
         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
         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.h> ]],
-        [[ 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}
index a5ce8c81b92afa08b8b00d7a7e311911862aed5f..3d46d702549e28dd3cb63c33a273d6a5bc9ce072 100644 (file)
@@ -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
index f03bd37bfc669ddfd58754ca0b76cbaa62f27eb1..7b577901374c7da3de9a8c2f3c8ef0bd8fdc3fad 100644 (file)
@@ -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
index 94662f4462f0ad62edcbe14f6ddc64f52fd22fbe..344ca051096f2d45bd62355a35c9b2883e7f527a 100644 (file)
@@ -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::
 
index 77000202c19a87e073ddd7f59f759c54f94a4003..9298ba33cf76074f390291b9e8320fcb71371ab9 100644 (file)
@@ -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);
index 8746d9b50b667af0911bdf1dc4f2cbb87c7eb7c9..2286d031734a6bd5b5c6d283354de705dd9c78e5 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include "suricata-common.h"
-#include "pcre.h"
 #include "debug.h"
 #include "decode.h"
 #include "detect.h"
index ed37bec946139b616a81a28d65d8f4274915cd69..98d73d2c47f5fe2fadc18df9aca322ad1cf2ed4a 100644 (file)
@@ -138,7 +138,6 @@ typedef unsigned short u_short
 typedef unsigned char u_char
 #endif
 
-#include <pcre.h>
 #include <pcre2.h>
 
 #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