- support RCMD_CMD, ala rcmd(3).

- put paths for rsh and rmt into "pathnames.h"
- document this.
This commit is contained in:
mrg 1998-03-08 23:36:46 +00:00
parent 90e5d61467
commit 5f2732ab6d
3 changed files with 58 additions and 6 deletions

32
lib/librmt/pathnames.h Normal file
View File

@ -0,0 +1,32 @@
/* $NetBSD: pathnames.h,v 1.1 1998/03/08 23:36:46 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#define _PATH_RSH "/usr/bin/rsh"
#define _PATH_RMT "/etc/rmt"

View File

@ -1,4 +1,4 @@
/* $NetBSD: rmtlib.c,v 1.9 1997/10/21 19:58:21 thorpej Exp $ */ /* $NetBSD: rmtlib.c,v 1.10 1998/03/08 23:36:46 mrg Exp $ */
/* /*
* rmt --- remote tape emulator subroutines * rmt --- remote tape emulator subroutines
@ -60,6 +60,8 @@
#include <varargs.h> #include <varargs.h>
#endif #endif
#include "pathnames.h"
static int _rmt_close __P((int)); static int _rmt_close __P((int));
static int _rmt_ioctl __P((int, unsigned long, char *)); static int _rmt_ioctl __P((int, unsigned long, char *));
static off_t _rmt_lseek __P((int, off_t, int)); static off_t _rmt_lseek __P((int, off_t, int));
@ -354,6 +356,8 @@ _rmt_open(path, oflag, mode)
if (rc == 0) if (rc == 0)
{ {
char *rshpath, *rsh;
close(0); close(0);
dup(Ptc[i][0]); dup(Ptc[i][0]);
close(Ptc[i][0]); close(Ptc[i][1]); close(Ptc[i][0]); close(Ptc[i][1]);
@ -362,15 +366,23 @@ _rmt_open(path, oflag, mode)
close(Ctp[i][0]); close(Ctp[i][1]); close(Ctp[i][0]); close(Ctp[i][1]);
(void) setuid (getuid ()); (void) setuid (getuid ());
(void) setgid (getgid ()); (void) setgid (getgid ());
if ((rshpath = getenv("RCMD_CMD")) == NULL)
rshpath = _PATH_RSH;
if ((rsh = strrchr(rshpath, '/')) == NULL)
rsh = rshpath;
else
rsh++;
if (*login) if (*login)
{ {
execl("/usr/bin/rsh", "rsh", system, "-l", login, execl(rshpath, rsh, system, "-l", login,
"/etc/rmt", (char *) 0); _PATH_RMT, (char *) 0);
} }
else else
{ {
execl("/usr/bin/rsh", "rsh", system, execl(rshpath, rsh, system,
"/etc/rmt", (char *) 0); _PATH_RMT, (char *) 0);
} }
/* /*

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rmtops.3,v 1.2 1996/08/09 03:39:02 jtc Exp $ .\" $NetBSD: rmtops.3,v 1.3 1998/03/08 23:36:46 mrg Exp $
.\" .\"
.TH RMTOPS 3 .TH RMTOPS 3
.SH NAME .SH NAME
@ -191,6 +191,14 @@ file in the user's home directory, or that the application designer
be willing to have be willing to have
.I rexec .I rexec
prompt the user for a login name and password on the remote host. prompt the user for a login name and password on the remote host.
.SH ENVIRONMENT
The
.I RCMD_CMD
environment variable can be set to the name or pathname of a program
to use, instead of
.P /usr/bin/rsh ,
and must have the same calling conventions as
.IR rsh(1).
.SH AUTHORS .SH AUTHORS
Jeff Lee (gatech!jeff) wrote the original routines for accessing Jeff Lee (gatech!jeff) wrote the original routines for accessing
tape drives via tape drives via