aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/inetd/inetd.c
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>1999-07-21 16:09:45 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>1999-07-21 16:09:45 +0000
commita9ed85ec46e9e448fedb34096926bf8a21ce88da (patch)
treefe672bd58485d079260116fa54c09b42379c5d3c /usr.sbin/inetd/inetd.c
parentcb711cfb320f99fa41275c2e4533d8a75300ab51 (diff)
downloadsrc-a9ed85ec46e9e448fedb34096926bf8a21ce88da.tar.gz
src-a9ed85ec46e9e448fedb34096926bf8a21ce88da.zip
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 <dwmalone@maths.tcd.ie>
Notes
Notes: svn path=/head/; revision=48962
Diffstat (limited to 'usr.sbin/inetd/inetd.c')
-rw-r--r--usr.sbin/inetd/inetd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 07ae88c01d7b..341c89b1396e 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.