public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/hydra] epel10: Fix C99 compatibility issues
@ 2026-11-06 15:25 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2026-11-06 15:25 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/hydra
            Branch : epel10
            Commit : 295e40350bf4a02e916892a9f5a9a16bcb70ad78
            Author : Florian Weimer <fweimer@redhat.com>
            Date   : 2023-01-18T16:49:19+01:00
            Stats  : +80/-13 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/hydra/c/295e40350bf4a02e916892a9f5a9a16bcb70ad78?branch=epel10

            Log:
            Fix C99 compatibility issues

hydra-openssl3.patch is not actually needed and introduces more
implicit function declarations.

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>

---
diff --git a/hydra-c99.patch b/hydra-c99.patch
new file mode 100644
index 0000000..de78cc4
--- /dev/null
+++ b/hydra-c99.patch
@@ -0,0 +1,75 @@
+Improve C99 compatibility by declaring called functions explicitly:
+
+strrchr is declared in <strings.h>, not <string.h>.
+
+_GNU_SOURCE needs to be defined before any glibc headers are included,
+otherwise it is not effective.
+
+Also patch some old autoconf-internal issues in the hydra-gtk
+configure script.
+
+Submitted upstream: <https://github.com/vanhauser-thc/thc-hydra/pull/817>
+
+diff --git a/configure b/configure
+index d9c8b020798c6b1c..425f80a8abdfbd00 100755
+--- a/configure
++++ b/configure
+@@ -1356,7 +1356,7 @@ echo "Checking for Android specialities ..."
+ TMPC=comptest$$
+ STRRCHR=" not"
+ echo '#include <stdio.h>' > $TMPC.c
+-echo '#include <strings.h>' >> $TMPC.c
++echo '#include <string.h>' >> $TMPC.c
+ echo "int main() { char *x = strrchr(\"test\", 'e'); if (x == NULL) return 0; else return 1; }" >> $TMPC.c
+ $CC -o $TMPC $TMPC.c > /dev/null 2>&1
+ test -x $TMPC && STRRCHR=""
+diff --git a/hydra-gtk/configure b/hydra-gtk/configure
+index 653ba7df294ebb82..6cd3de715ba40056 100755
+--- a/hydra-gtk/configure
++++ b/hydra-gtk/configure
+@@ -2391,7 +2391,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; }; then
+   for ac_declaration in \
+-   '' \
++   '#include <stdlib.h>' \
+    'extern "C" void std::exit (int) throw (); using std::exit;' \
+    'extern "C" void std::exit (int); using std::exit;' \
+    'extern "C" void exit (int) throw ();' \
+@@ -3192,7 +3192,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; }; then
+   for ac_declaration in \
+-   '' \
++   '#include <stdlib.h>' \
+    'extern "C" void std::exit (int) throw (); using std::exit;' \
+    'extern "C" void std::exit (int); using std::exit;' \
+    'extern "C" void exit (int) throw ();' \
+@@ -3797,8 +3797,8 @@ main ()
+   for (i = 0; i < 256; i++)
+     if (XOR (islower (i), ISLOWER (i))
+ 	|| toupper (i) != TOUPPER (i))
+-      exit(2);
+-  exit (0);
++      return 2;
++  return 0;
+ }
+ _ACEOF
+ rm -f conftest$ac_exeext
+diff --git a/hydra-rtsp.c b/hydra-rtsp.c
+index 3b6e84b292761d23..3b4bdca021111f47 100644
+--- a/hydra-rtsp.c
++++ b/hydra-rtsp.c
+@@ -6,10 +6,11 @@
+ //
+ //
+ 
++#define _GNU_SOURCE
++
+ #include "hydra-mod.h"
+ #include "sasl.h"
+ #include <stdio.h>
+-#define _GNU_SOURCE
+ #include <string.h>
+ 
+ extern char *HYDRA_EXIT;

diff --git a/hydra-openssl3.patch b/hydra-openssl3.patch
deleted file mode 100644
index 1deac3f..0000000
--- a/hydra-openssl3.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -up thc-hydra-9.2/hydra-mod.c.me thc-hydra-9.2/hydra-mod.c
---- thc-hydra-9.2/hydra-mod.c.me	2022-05-03 11:09:06.514000559 +0200
-+++ thc-hydra-9.2/hydra-mod.c	2022-05-03 11:10:20.699727082 +0200
-@@ -2,7 +2,6 @@
- #include <arpa/inet.h>
- #ifdef LIBOPENSSL
- #include <openssl/bn.h>
--#include <openssl/err.h>
- #include <openssl/rsa.h>
- #include <openssl/ssl.h>
- #endif

diff --git a/hydra.spec b/hydra.spec
index eb130ad..412a832 100644
--- a/hydra.spec
+++ b/hydra.spec
@@ -1,7 +1,7 @@
 Summary:        Very fast network log-on cracker
 Name:           hydra
 Version:        9.4
-Release:        1%{?dist}
+Release:        2%{?dist}
 License:        AGPLv3 with exceptions
 # Old URL       https://www.thc.org/thc-hydra/
 URL:            https://github.com/vanhauser-thc/thc-hydra
@@ -12,7 +12,7 @@ Source2:        xhydra.png
 # Sent upstream via email 20120518
 Patch0:         hydra-use-system-libpq-fe.patch
 Patch1:         hydra-fix-dpl4hydra-dir.patch
-Patch2:         hydra-openssl3.patch
+Patch2:         hydra-c99.patch
 
 BuildRequires:  apr-devel
 BuildRequires:  desktop-file-utils
@@ -101,6 +101,9 @@ sed -i 's|^INSTALLDIR=.*|INSTALLDIR=/usr|' %{buildroot}/%{_bindir}/dpl4hydra.sh
 %{_datadir}/applications/*
 
 %changelog
+* Wed Jan 18 2023 Florian Weimer <fweimer@redhat.com> - 9.4-2
+- C99 compatibility fixes
+
 * Sun Oct 16 2022 Othman Madjoudj <athmane@fedoraproject.org> - 9.4-1
 - Update to 9.4 (rhbz #2125386)
 - Switch to PCRE2 (rhbz #2128308)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-06 15:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 15:25 [rpms/hydra] epel10: Fix C99 compatibility issues Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox