diff options
author | 2022-04-13 02:39:51 +0100 | |
---|---|---|
committer | 2022-04-13 02:39:59 +0100 | |
commit | 1b6d55530908535b7439045af4ea35a096ee4a95 (patch) | |
tree | ca12c1206e49d6e8a120d919355d478c1cb1c0f8 /net-analyzer/hydra/files | |
parent | media-sound/mpd: fix automagic deps (diff) | |
download | gentoo-1b6d55530908535b7439045af4ea35a096ee4a95.tar.gz gentoo-1b6d55530908535b7439045af4ea35a096ee4a95.tar.bz2 gentoo-1b6d55530908535b7439045af4ea35a096ee4a95.zip |
net-analyzer/hydra: add 9.3
Closes: https://bugs.gentoo.org/805533
Closes: https://bugs.gentoo.org/838031
Closes: https://bugs.gentoo.org/811798
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-analyzer/hydra/files')
-rw-r--r-- | net-analyzer/hydra/files/hydra-9.3-pcre2.patch | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/net-analyzer/hydra/files/hydra-9.3-pcre2.patch b/net-analyzer/hydra/files/hydra-9.3-pcre2.patch new file mode 100644 index 000000000000..bb12936254bb --- /dev/null +++ b/net-analyzer/hydra/files/hydra-9.3-pcre2.patch @@ -0,0 +1,113 @@ +https://github.com/vanhauser-thc/thc-hydra/commit/c82e5d51c5595374e6b7801bfc84c26a497d8989.patch +https://bugs.gentoo.org/838031 + +From c82e5d51c5595374e6b7801bfc84c26a497d8989 Mon Sep 17 00:00:00 2001 +From: vanhauser-thc <vh@thc.org> +Date: Tue, 1 Mar 2022 14:56:05 +0100 +Subject: [PATCH] switch to pcre2 + +--- a/configure ++++ b/configure +@@ -380,21 +380,21 @@ if [ "X" = "X$CURSES_PATH" -o "X" = "X$CURSES_IPATH" ]; then + CURSES_IPATH="" + fi + +-echo "Checking for pcre (libpcre/pcre.h) ..." ++echo "Checking for pcre2 (libpcre/pcre.h) ..." + for i in $LIBDIRS ; do + if [ "X" = "X$PCRE_PATH" ]; then +- if [ -f "$i/libpcre.so" -o -f "$i/libpcre.dylib" -o -f "$i/libpcre.a" ]; then ++ if [ -f "$i/libpcre2-8.so" -o -f "$i/libpcre2-8.dylib" -o -f "$i/libpcre2-8.a" ]; then + PCRE_PATH="$i" + fi + fi + if [ "X" = "X$PCRE_PATH" ]; then +- TMP_LIB=`/bin/ls $i/libpcre.so* 2> /dev/null | grep libpcre.` ++ TMP_LIB=`/bin/ls $i/libpcre2*.so* 2> /dev/null | grep libpcre.` + if [ -n "$TMP_LIB" ]; then + PCRE_PATH="$i" + fi + fi + if [ "X" = "X$PCRE_PATH" ]; then +- TMP_LIB=`/bin/ls $i/libpcre.dll* 2> /dev/null | grep libpcre.` ++ TMP_LIB=`/bin/ls $i/libpcre2*.dll* 2> /dev/null | grep libpcre.` + if [ -n "$TMP_LIB" ]; then + PCRE_PATH="$i" + fi +@@ -402,20 +402,20 @@ for i in $LIBDIRS ; do + done + for i in $INCDIRS ; do + if [ "X" != "X$PCRE_PATH" ]; then +- if [ -f "$i/pcre.h" ]; then ++ if [ -f "$i/pcre2.h" ]; then + PCRE_IPATH="$i" + fi + fi + done + if [ "X" != "X$DEBUG" ]; then + echo DEBUG: PCRE_PATH=$PCRE_PATH/libpcre +- echo DEBUG: PCRE_IPATH=$PCRE_IPATH/pcre.h ++ echo DEBUG: PCRE_IPATH=$PCRE_IPATH/pcre2.h + fi + if [ -n "$PCRE_PATH" -a -n "$PCRE_IPATH" ]; then +- echo " ... found" ++ echo " ... found" + fi + if [ "X" = "X$PCRE_PATH" -o "X" = "X$PCRE_IPATH" ]; then +- echo " ... NOT found, server response checks will be less reliable" ++ echo " ... NOT found, server response checks will be less reliable" + PCRE_PATH="" + PCRE_IPATH="" + fi +@@ -1649,7 +1649,7 @@ if [ -n "$IDN_PATH" ]; then + XLIBS="$XLIBS -lidn" + fi + if [ -n "$PCRE_PATH" ]; then +- XLIBS="$XLIBS -lpcre" ++ XLIBS="$XLIBS -lpcre2-8" + fi + if [ -n "$MYSQL_PATH" ]; then + XLIBS="$XLIBS -lmysqlclient" +--- a/hydra-mod.c ++++ b/hydra-mod.c +@@ -7,7 +7,8 @@ + #include <openssl/ssl.h> + #endif + #ifdef HAVE_PCRE +-#include <pcre.h> ++#define PCRE2_CODE_UNIT_WIDTH 8 ++#include <pcre2.h> + #endif + + #define MAX_CONNECT_RETRY 1 +@@ -1291,19 +1292,23 @@ void hydra_set_srcport(int32_t port) { src_port = port; } + + #ifdef HAVE_PCRE + int32_t hydra_string_match(char *str, const char *regex) { +- pcre *re = NULL; +- int32_t offset_error = 0; +- const char *error = NULL; ++ pcre2_code *re = NULL; ++ int32_t error_code = 0; ++ PCRE2_SIZE error_offset; + int32_t rc = 0; + +- re = pcre_compile(regex, PCRE_CASELESS | PCRE_DOTALL, &error, &offset_error, NULL); ++ re = pcre2_compile(regex, PCRE2_ZERO_TERMINATED, PCRE2_CASELESS | PCRE2_DOTALL, &error_code, &error_offset, NULL); + if (re == NULL) { +- fprintf(stderr, "[ERROR] PCRE compilation failed at offset %d: %s\n", offset_error, error); ++ fprintf(stderr, "[ERROR] PCRE compilation failed at offset %d: %d\n", error_offset, error_code); + return 0; + } + +- rc = pcre_exec(re, NULL, str, strlen(str), 0, 0, NULL, 0); +- if (rc >= 0) { ++ pcre2_match_data *match_data = pcre2_match_data_create_from_pattern(re, NULL); ++ rc = pcre2_match(re, str, PCRE2_ZERO_TERMINATED, 0, 0, match_data, NULL); ++ pcre2_match_data_free(match_data); ++ pcre2_code_free(re); ++ ++ if (rc >= 1) { + return 1; + } + return 0; |