From cd7ecc6fc022e270d89e62000744e4a6d41d0465 Mon Sep 17 00:00:00 2001 From: sheldonh Date: Wed, 21 Jul 1999 16:09:45 +0000 Subject: Fix for the hosts_options(5) spawn option. Restore default SIGHUP, SIGCHLD and SIGALRM handlers in forked inetd processes. This happens to work around the fact that hosts_access() doesn't (but should) set SIG_IGN as the handler for SIGCHLD while it handles the spawn option, but it would make sense even if that were not true. This does not address the leaking descriptors issue discussed on the same PR. PR: 12731 Reviewed by: des Submitted by: David Malone --- usr.sbin/inetd/inetd.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'usr.sbin/inetd') diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 07ae88c..341c89b 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94"; #endif static const char rcsid[] = - "$Id: inetd.c,v 1.61 1999/07/15 17:01:43 green Exp $"; + "$Id: inetd.c,v 1.62 1999/07/21 12:19:24 sheldonh Exp $"; #endif /* not lint */ /* @@ -351,7 +351,7 @@ main(argc, argv, envp) struct servtab *sep; struct passwd *pwd; struct group *grp; - struct sigaction sa, sapipe; + struct sigaction sa, saalrm, sachld, sahup, sapipe; int tmpint, ch, dofork; pid_t pid; char buf[50]; @@ -457,12 +457,12 @@ main(argc, argv, envp) sigaddset(&sa.sa_mask, SIGCHLD); sigaddset(&sa.sa_mask, SIGHUP); sa.sa_handler = flag_retry; - sigaction(SIGALRM, &sa, (struct sigaction *)0); + sigaction(SIGALRM, &sa, &saalrm); config(); sa.sa_handler = flag_config; - sigaction(SIGHUP, &sa, (struct sigaction *)0); + sigaction(SIGHUP, &sa, &sahup); sa.sa_handler = flag_reapchild; - sigaction(SIGCHLD, &sa, (struct sigaction *)0); + sigaction(SIGCHLD, &sa, &sachld); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, &sapipe); @@ -624,6 +624,10 @@ main(argc, argv, envp) for (tmpint = maxsock; tmpint > 2; tmpint--) if (tmpint != ctrl) (void) close(tmpint); + sigaction(SIGALRM, &saalrm, (struct sigaction *)0); + sigaction(SIGCHLD, &sachld, (struct sigaction *)0); + sigaction(SIGHUP, &sahup, (struct sigaction *)0); + /* SIGPIPE reset before exec */ } /* * Call tcpmux to find the real service to exec. -- cgit v1.1