From b3e2e257d052640e288a3c65901433496f71ef1c Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Mon, 16 Apr 2007 10:54:34 +0000 Subject: [PATCH] - added restore_sigalarm and siglongjmp patches from Debian, fixes #205129 --- tcp_wrappers-7.6-restore_sigalarm.patch | 37 +++++++++++++++++++++++++ tcp_wrappers-7.6-siglongjmp.patch | 30 ++++++++++++++++++++ tcp_wrappers.spec | 9 +++++- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 tcp_wrappers-7.6-restore_sigalarm.patch create mode 100644 tcp_wrappers-7.6-siglongjmp.patch diff --git a/tcp_wrappers-7.6-restore_sigalarm.patch b/tcp_wrappers-7.6-restore_sigalarm.patch new file mode 100644 index 0000000..ece7da3 --- /dev/null +++ b/tcp_wrappers-7.6-restore_sigalarm.patch @@ -0,0 +1,37 @@ +diff -ruN tcp_wrappers_7.6.orig/rfc931.c tcp_wrappers_7.6/rfc931.c +--- tcp_wrappers_7.6.orig/rfc931.c 2004-08-29 18:40:08.000000000 +0200 ++++ tcp_wrappers_7.6/rfc931.c 2004-08-29 18:40:02.000000000 +0200 +@@ -92,6 +92,8 @@ + char *cp; + char *result = unknown; + FILE *fp; ++ unsigned saved_timeout; ++ struct sigaction nact, oact; + + #ifdef INET6 + /* address family must be the same */ +@@ -134,7 +136,12 @@ + */ + + if (setjmp(timebuf) == 0) { +- signal(SIGALRM, timeout); ++ /* Save SIGALRM timer and handler. Sudheer Abdul-Salam, SUN. */ ++ saved_timeout = alarm(0); ++ nact.sa_handler = timeout; ++ nact.sa_flags = 0; ++ (void) sigemptyset(&nact.sa_mask); ++ (void) sigaction(SIGALRM, &nact, &oact); + alarm(rfc931_timeout); + + /* +@@ -223,6 +230,10 @@ + } + alarm(0); + } ++ /* Restore SIGALRM timer and handler. Sudheer Abdul-Salam, SUN. */ ++ (void) sigaction(SIGALRM, &oact, NULL); ++ if (saved_timeout > 0) ++ alarm(saved_timeout); + fclose(fp); + } + STRN_CPY(dest, result, STRING_LENGTH); diff --git a/tcp_wrappers-7.6-siglongjmp.patch b/tcp_wrappers-7.6-siglongjmp.patch new file mode 100644 index 0000000..ed271fc --- /dev/null +++ b/tcp_wrappers-7.6-siglongjmp.patch @@ -0,0 +1,30 @@ +diff -ruNp tcp_wrappers_7.6.orig/rfc931.c tcp_wrappers_7.6/rfc931.c +--- tcp_wrappers_7.6.orig/rfc931.c 2004-08-29 18:42:25.000000000 +0200 ++++ tcp_wrappers_7.6/rfc931.c 2004-08-29 18:41:04.000000000 +0200 +@@ -33,7 +33,7 @@ static char sccsid[] = "@(#) rfc931.c 1. + + int rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */ + +-static jmp_buf timebuf; ++static sigjmp_buf timebuf; + + /* fsocket - open stdio stream on top of socket */ + +@@ -62,7 +62,7 @@ int protocol; + static void timeout(sig) + int sig; + { +- longjmp(timebuf, sig); ++ siglongjmp(timebuf, sig); + } + + /* rfc931 - return remote user name, given socket structures */ +@@ -135,7 +135,7 @@ char *dest; + * Set up a timer so we won't get stuck while waiting for the server. + */ + +- if (setjmp(timebuf) == 0) { ++ if (sigsetjmp(timebuf, 1) == 0) { + /* Save SIGALRM timer and handler. Sudheer Abdul-Salam, SUN. */ + saved_timeout = alarm(0); + nact.sa_handler = timeout; diff --git a/tcp_wrappers.spec b/tcp_wrappers.spec index 1bf706b..170dc02 100644 --- a/tcp_wrappers.spec +++ b/tcp_wrappers.spec @@ -1,7 +1,7 @@ Summary: A security tool which acts as a wrapper for TCP daemons. Name: tcp_wrappers Version: 7.6 -Release: 43%{?dist} +Release: 44%{?dist} %define LIB_MAJOR 0 %define LIB_MINOR 7 @@ -28,6 +28,8 @@ Patch14: tcp_wrappers-7.6-ldflags.patch Patch15: tcp_wrappers-7.6-fix_sig-bug141110.patch Patch16: tcp_wrappers-7.6-162412.patch Patch17: tcp_wrappers-7.6-220015.patch +Patch18: tcp_wrappers-7.6-restore_sigalarm.patch +Patch19: tcp_wrappers-7.6-siglongjmp.patch # required by sin_scope_id in ipv6 patch BuildRequires: glibc-devel >= 2.2 BuildRoot: %{_tmppath}/%{name}-root @@ -81,6 +83,8 @@ develop applications with tcp_wrappers support. %patch15 -p1 -b .fix_sig %patch16 -p1 -b .162412 %patch17 -p1 -b .220015 +%patch18 -p1 -b .restore_sigalarm +%patch19 -p1 -b .siglongjmp %build make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIC -DPIC -D_REENTRANT -DHAVE_STRERROR" LDFLAGS="-pie" MAJOR=%{LIB_MAJOR} MINOR=%{LIB_MINOR} REL=%{LIB_REL} linux @@ -137,6 +141,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man3/* %changelog +* Mon Apr 16 2007 Tomas Janousek - 7.6-44 +- added restore_sigalarm and siglongjmp patches from Debian, fixes #205129 + * Fri Mar 09 2007 Tomas Janousek - 7.6-43 - resolve hostnames in hosts.{allow,deny}, should fix a bunch of issues with IPv4/6