Date: Mon, 5 May 2003 22:40:21 -0400 From: David Magda <dmagda@magda.ca> To: Murray Stokely <murray@FreeBSD.org> Cc: freebsd-doc@FreeBSD.org Subject: Re: docs/51133: RSH environmental variable not described in rcmd(3) Message-ID: <20030506024019.GA2558@number6.magda.ca> In-Reply-To: <200305042146.h44LkoQs047864@freefall.freebsd.org> References: <200305042146.h44LkoQs047864@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, May 04, 2003 at 02:46:50PM -0700, Murray Stokely wrote: > Yes we should update these man pages. Is there any chance the > submitter can give us a patch to update the pages? If not, I will > work on this. Don't know anything about groff (?) formatting so here's the text and I'll let someone who knows it get the details right. In the DESCRIPTION section, insert the following after the first sentence in first paragraph: If the calling process is not setuid, the RSH environment variable is set, and inport is ``shell/tcp'', rcmdsh(3) is called instead with the value of RSH. Alternately, if the user is not the superuser, rcmd() will invoke rcmdsh(3) to run the command via rsh(1). While rcmd() can handle IPv4 cases only, the rcmd_af() function can handle other cases as well. Then start a new paragraph. Continue of with the rest of the text of the man page. This will basically make FreeBSD's man page match OpenBSD's rcmd(3) [1]. Next, create an ENVIRONMENT section and add the following text: RSH When using the rcmd() function, this variable is used as the program to run instead of rsh(1). This part is taken from NetBSD's rcmd(3) [2]: the main change is that Net has a program rcmd(1) so that users could call rcmd(3) without having to be the super-user, and Net uses the variable RCMD_CMD. The above ENVIRONMENT section should also be added to dump(8) and restore(8) since they will run $RSH if it is defined. I sent an email suggesting so to docs@ but haven't received a reply and nothing's been committed to CVS. Doing a quick find/grep, rdist(1) also uses rcmd(3) so would probably be effective by $RSH. Also, just curious. Why does OpenBSD have the following code in rcmd.c [3]: if (!issetugid() && (p = getenv("RSH")) && *p) { struct servent *sp = getservbyname("shell", "tcp"); While FreeBSD has the following [4]: if (!issetugid() && (p = getenv("RSH"))) { struct servent *sp = getservbyname("shell", "tcp"); The difference being the "&& *p". This difference was introduced by the OpenBSD (by millet) in their rev. 1.37 [5] with the commit message of "Make sure $RSH is not the empty string." How beneficial would it be if this was added to FreeBSD's code? [1] http://www.openbsd.org/cgi-bin/man.cgi?query=rcmd [2] http://netbsd.gw.com/cgi-bin/man-cgi?rcmd+3 [3] http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/net/rcmd.c?rev=1.45 [4] http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/net/rcmd.c?rev=1.38 [5] http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/net/rcmd.c.diff?r1=1.36&r2=1.37
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030506024019.GA2558>