From owner-freebsd-doc@FreeBSD.ORG Mon May 5 19:40:25 2003 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E9AB137B401; Mon, 5 May 2003 19:40:24 -0700 (PDT) Received: from tomts16-srv.bellnexxia.net (tomts16-srv.bellnexxia.net [209.226.175.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3314943F93; Mon, 5 May 2003 19:40:23 -0700 (PDT) (envelope-from dmagda@magda.ca) Received: from number6.magda.ca ([64.229.225.45]) by tomts16-srv.bellnexxia.netESMTP <20030506024022.BRPX18098.tomts16-srv.bellnexxia.net@number6.magda.ca>; Mon, 5 May 2003 22:40:22 -0400 Received: from number6.magda.ca (localhost.magda.ca [127.0.0.1]) by number6.magda.ca (8.12.9/8.12.7) with ESMTP id h462eLhQ002676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 May 2003 22:40:21 -0400 (EDT) (envelope-from dmagda@magda.ca) Received: (from dmagda@localhost) by number6.magda.ca (8.12.9/8.12.7/Submit) id h462eLBC002675; Mon, 5 May 2003 22:40:21 -0400 (EDT) (envelope-from dmagda) Date: Mon, 5 May 2003 22:40:21 -0400 From: David Magda To: Murray Stokely Message-ID: <20030506024019.GA2558@number6.magda.ca> References: <200305042146.h44LkoQs047864@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200305042146.h44LkoQs047864@freefall.freebsd.org> User-Agent: Mutt/1.4.1i cc: freebsd-doc@FreeBSD.org Subject: Re: docs/51133: RSH environmental variable not described in rcmd(3) X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Magda List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2003 02:40:26 -0000 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