iputils/iputils-sec-ping-unblock.diff

40 lines
1.1 KiB
Diff
Raw Normal View History

From bf83678619dd0286f7a66f2ab02763751b0e8ca9 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 26 Aug 2013 13:02:36 +0200
Subject: Block SIGALRM in ping.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ping depends on SIGALRM to exit eventually, so we need to mask
it with UNBLOCK.
Signed-off-by: Marcus Schäfer <ms@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
ping.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Accepting request 397465 from home:markoschandras:branches:network:utilities - Update to version s20160308 (Changes taken from the RELNOTES file) * use syntax compatible with busybox date in Makefile * 'admin prohibited' should print !X not !S. * Makefile: use #define as in previous code changes * doc/Makefile: require bash, because we use pushd and popd * doc: don't timestamp manpages by default * ping: status() now returns received/transmitted instead of trans/recv * ping: don't mess with internals of struct msghdr * ping: ICMP error replies while errno < 0 is a hard error * ping: always use POSIX locale when parsing -i * ping: link against libm * made ping functions protocol independent * ping: perform dual-stack ping by default * ping: remove obsolete preprocessor directives * ping: avoid name clashes between IPv4 and IPv6 code * ping: merge all ping header files into a single one * ping: merge `ping6` command into `ping` * ping: refactor ping options * ping: refactor ping socket code * ping: merge IPv4 and IPv6 `pr_addr()` * ping: fix defines and libs in Makefile * ping: handle single protocol systems * iputils ping/ping6: Add a function to check if a packet is ours * ping: Add <linux/types.h> to fix compilation error. * ping6: Use GNUTLS API directly for MD5. (v2) * ping6: Use libgcrypt instead of gnutls for MD5. * Allow ping to use IPv6 addresses * ping,ping6 doc: More description on CAP_NET_RAW usage. * if IPv4 resolving fails fallback to ping6 * ping: in usage print the 'ping -6' options as well OBS-URL: https://build.opensuse.org/request/show/397465 OBS-URL: https://build.opensuse.org/package/show/network:utilities/iputils?expand=0&rev=41
2016-05-23 17:21:37 +02:00
Index: iputils/ping.c
===================================================================
--- iputils.orig/ping.c
+++ iputils/ping.c
@@ -443,6 +443,17 @@ main(int argc, char **argv)
/* Create sockets */
enable_capability_raw();
+
+ /*
+ * ping depend on SIGALARM to exit sometimes,
+ * but to popen, system, fork carry on parent signal handler
+ * so we mask it ourself.
+ */
+ sigset_t s;
+ sigaddset(&s, SIGALRM);
+ sigprocmask(SIG_UNBLOCK, &s, NULL);
+ set_signal(SIGALRM, doexit);
+
if (hints.ai_family != AF_INET6)
Accepting request 397465 from home:markoschandras:branches:network:utilities - Update to version s20160308 (Changes taken from the RELNOTES file) * use syntax compatible with busybox date in Makefile * 'admin prohibited' should print !X not !S. * Makefile: use #define as in previous code changes * doc/Makefile: require bash, because we use pushd and popd * doc: don't timestamp manpages by default * ping: status() now returns received/transmitted instead of trans/recv * ping: don't mess with internals of struct msghdr * ping: ICMP error replies while errno < 0 is a hard error * ping: always use POSIX locale when parsing -i * ping: link against libm * made ping functions protocol independent * ping: perform dual-stack ping by default * ping: remove obsolete preprocessor directives * ping: avoid name clashes between IPv4 and IPv6 code * ping: merge all ping header files into a single one * ping: merge `ping6` command into `ping` * ping: refactor ping options * ping: refactor ping socket code * ping: merge IPv4 and IPv6 `pr_addr()` * ping: fix defines and libs in Makefile * ping: handle single protocol systems * iputils ping/ping6: Add a function to check if a packet is ours * ping: Add <linux/types.h> to fix compilation error. * ping6: Use GNUTLS API directly for MD5. (v2) * ping6: Use libgcrypt instead of gnutls for MD5. * Allow ping to use IPv6 addresses * ping,ping6 doc: More description on CAP_NET_RAW usage. * if IPv4 resolving fails fallback to ping6 * ping: in usage print the 'ping -6' options as well OBS-URL: https://build.opensuse.org/request/show/397465 OBS-URL: https://build.opensuse.org/package/show/network:utilities/iputils?expand=0&rev=41
2016-05-23 17:21:37 +02:00
create_socket(&sock4, AF_INET, hints.ai_socktype, IPPROTO_ICMP, hints.ai_family == AF_INET);
if (hints.ai_family != AF_INET)