From owner-freebsd-hackers Thu Jun 24 16:53:41 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp4.erols.com (smtp4.erols.com [207.172.3.237]) by hub.freebsd.org (Postfix) with ESMTP id D87FB14D50 for ; Thu, 24 Jun 1999 16:53:38 -0700 (PDT) (envelope-from jobaldwi@vt.edu) Received: from john.baldwin.cx (207-172-143-253.s62.as3.hgt.md.dialup.rcn.com [207.172.143.253]) by smtp4.erols.com (8.8.8/smtp-v1) with ESMTP id TAA06995; Thu, 24 Jun 1999 19:53:09 -0400 (EDT) Message-Id: <199906242353.TAA06995@smtp4.erols.com> X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <48963.930215163@axl.noc.iafrica.com> Date: Thu, 24 Jun 1999 19:53:08 -0400 (EDT) From: John Baldwin To: Sheldon Hearn Subject: Re: Inetd and wrapping. Cc: freebsd-hackers@freebsd.org, David Malone , John Baldwin , Doug Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 24-Jun-99 Sheldon Hearn wrote: > > > On Thu, 24 Jun 1999 01:53:32 MST, Doug wrote: > >> As long as you acknowledge that in this case, "You can't have it" is a >> design decision, and not everyone agrees with your concept of the design. >> Personally I don't care enough about it to write the patch, but that won't >> stop me from registering an objection since you seem to be assuming that >> silence == assent. > > You're right. If I make my intentions publically known and nobody > objects, I assume public agreement. So I acknowledge that we're involved > in design decisions here. > >> You need to start thinking of things in terms of the much more common >> case, the casual user who will be going from say, 3.0-Release to >> 3.3-Release without reading any of the documentation. > > You're making assumptions about what I'm trying to achieve. I'm quite > sensitive to upgrade issues. > >> Why should this user have to either go out of his way to fix something >> that wasn't broken, or find a critical service disabled when he >> reboots just because no one could be bothered to make the new >> interface compatible? > > Okay, this is what makes sense. :-) > > I do agree that it should be as easy as possible to upgrade from > 3.2-RELEASE to 3.3-RELEASE. What you need to see is that such an upgrade > _will_ involve changing some things, which is why we offer people > release notes. What we're discussing (and have up until now disagreed > on) is how much has to change. > > Since none of the people who've suggested per-case exclusion options > for wrapping have come up with diffs, it's something I'll have to think > about. If I can come up with something backward compatible without > rupturing a testicle, I'll do so. > > Watch this space for details. :-) Ok. since you asked: Here's one possibility, it adds a a wrap/nowrap field that goes beside the wait/nowait field, so you would have: ftp stream tcp nowait wrap root /usr/libexec/ftpd ftpd -l as an example of ftp being wrapped. here's the patch to inetd.c (against -stable, which is all I have at the moment): Index: inetd.c =================================================================== RCS file: /usr/cvs/src/usr.sbin/inetd/inetd.c,v retrieving revision 1.46.2.2 diff -u -r1.46.2.2 inetd.c --- inetd.c 1999/05/12 07:02:02 1.46.2.2 +++ inetd.c 1999/06/24 23:36:24 @@ -73,6 +73,7 @@ * socket type stream/dgram/raw/rdm/seqpacket * protocol must be in /etc/protocols * wait/nowait single-threaded/multi-threaded + * wrap/nowrap wrapped or not * user user to run daemon as * server program full path name * server program arguments maximum of MAXARGS (20) @@ -97,6 +98,7 @@ * socket type stream/dgram/raw/rdm/seqpacket * protocol must be in /etc/protocols * wait/nowait single-threaded/multi-threaded + * wrap/nowrap wrapped or not * user user to run daemon as * server program full path name * server program arguments maximum of MAXARGS @@ -215,6 +217,9 @@ u_char se_type; /* type: normal, mux, or mux+ */ u_char se_checked; /* looked at during merge */ u_char se_accept; /* i.e., wait/nowait mode */ +#ifdef LIBWRAP_INTERNAL + u_char se_wrap; /* wrap/nowrap mode */ +#endif u_char se_rpc; /* ==1 if RPC service */ int se_rpc_prog; /* RPC program number */ u_int se_rpc_lowvers; /* RPC low version */ @@ -621,6 +626,8 @@ #ifdef LIBWRAP #ifndef LIBWRAP_INTERNAL if (sep->se_bi == 0) +#else + if (sep->se_wrap) #endif if (sep->se_accept && sep->se_socktype == SOCK_STREAM) { @@ -905,6 +912,9 @@ } } sep->se_accept = new->se_accept; +#ifdef LIBWRAP_INTERNAL + sep->se_wrap = new->se_wrap; +#endif SWAP(sep->se_user, new->se_user); SWAP(sep->se_group, new->se_group); #ifdef LOGIN_CAP @@ -1377,6 +1387,19 @@ goto more; } } +#ifdef LIBWRAP_INTERNAL + arg = sskip(&cp); + if (!strncmp(arg, "wrap", 4)) + sep->se_wrap = 1; + else if (!strncmp(arg, "nowrap", 6)) + sep->se_wrap = 0; + else { + syslog(LOG_ERR, + "%s: bad wrap/nowrap for services %s", + CONFIG, sep->se_service); + goto more; + } +#endif sep->se_user = newstr(sskip(&cp)); #ifdef LOGIN_CAP if ((s = strrchr(sep->se_user, '/')) != NULL) { I've tested this on my -stable box and it worked. My world is from almost a month ago though.. I've been having problems cvsup'ing, so I don't have any more recent -stable sources, sorry. If you don't like the wrap/nowrap field, then I'll try adn think up another way to do this (maybe wait/nowait/wait-wrap/nowait-wrap ?), as I realize that this would make older inetd.conf files out of date. > Cia, > Sheldon. --- John Baldwin -- http://members.freedomnet.com/~jbaldwin/ PGP Key: http://members.freedomnet.com/~jbaldwin/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message