Date: Thu, 20 May 1999 08:00:02 -0700 (PDT) From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/11651: inetd's childs staying around after a scan Message-ID: <199905201500.IAA43268@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/11651; it has been noted by GNATS. From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-gnats-submit@freebsd.org Cc: Pierre Beyssac <pb@fasterix.freenix.org>, markm@freebsd.org Subject: Re: bin/11651: inetd's childs staying around after a scan Date: Thu, 20 May 1999 16:52:35 +0200 Hi Pierre, This was caused by an oversight in our handling of internal service wrapping. The feature was disabled by markm when the problem was discovered, since neither he nor I felt like looking at it at the time. The problem is that the code as compiled with -DLIBWRAP_INTERNAL forks for _all_ services, even internals whose se_bi flag is _not_ set. This invalidates the assumption made at line 657 (inetd.c v1.49). Please would you try the following patch. I've tested it for external, forking internal and non-forking internal services for each of the following three cases: no wrapping -DLIBWRAP -DLIBWRAP -DLIBWRAP_INTERNAL So it should work fine for you. Ciao, Sheldon. Index: Makefile =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/Makefile,v retrieving revision 1.8 diff -u -d -r1.8 Makefile --- Makefile 1999/05/07 06:48:01 1.8 +++ Makefile 1999/05/20 14:34:35 @@ -5,7 +5,7 @@ MAN8= inetd.8 MLINKS= inetd.8 inetd.conf.5 -COPTS+= -Wall -DLOGIN_CAP -DLIBWRAP +COPTS+= -Wall -DLOGIN_CAP -DLIBWRAP -DLIBWRAP_INTERNAL #COPTS+= -DSANITY_CHECK DPADD+= ${LIBUTIL} ${LIBWRAP} Index: inetd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/inetd/inetd.c,v retrieving revision 1.49 diff -u -d -r1.49 inetd.c --- inetd.c 1999/05/11 12:50:14 1.49 +++ inetd.c 1999/05/20 14:14:02 @@ -556,11 +556,7 @@ ctrl = sep->se_fd; (void) sigblock(SIGBLOCK); pid = 0; -#ifdef LIBWRAP_INTERNAL - dofork = 1; -#else dofork = (sep->se_bi == 0 || sep->se_bi->bi_fork); -#endif if (dofork) { if (sep->se_count++ == 0) (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); @@ -746,7 +742,8 @@ #endif if (sep->se_socktype != SOCK_STREAM) recv(0, buf, sizeof (buf), 0); - _exit(EX_OSERR); + if (dofork) + _exit(EX_OSERR); } } if (sep->se_accept && sep->se_socktype == SOCK_STREAM) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905201500.IAA43268>