diff options
author | ume <ume@FreeBSD.org> | 2001-02-18 17:30:29 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2001-02-18 17:30:29 +0000 |
commit | 3b9f9179f5c6f2ecbbcb3ad8e77a6c516ef9735a (patch) | |
tree | f906a318c89cd6bf2ff97a37f4054b184998b4ff /gnu/usr.bin/tar/rtapelib.c | |
parent | 548e16646ad1b2c4238bf0ca29ed5c33e1efff74 (diff) | |
download | FreeBSD-src-3b9f9179f5c6f2ecbbcb3ad8e77a6c516ef9735a.zip FreeBSD-src-3b9f9179f5c6f2ecbbcb3ad8e77a6c516ef9735a.tar.gz |
Introduce $TAR_RSH to enable use of ssh as transport.
Diffstat (limited to 'gnu/usr.bin/tar/rtapelib.c')
-rw-r--r-- | gnu/usr.bin/tar/rtapelib.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/gnu/usr.bin/tar/rtapelib.c b/gnu/usr.bin/tar/rtapelib.c index 0c23b06..67fc919 100644 --- a/gnu/usr.bin/tar/rtapelib.c +++ b/gnu/usr.bin/tar/rtapelib.c @@ -31,6 +31,8 @@ Modified to make all rmtXXX calls into macros for speed by Jay Fenlason. Use -DHAVE_NETDB_H for rexec code, courtesy of Dan Kegel, srs!dan. */ +/* $FreeBSD$ */ + #include <stdio.h> #include <sys/types.h> #include <signal.h> @@ -276,6 +278,7 @@ __rmt_open (path, oflag, mode, bias) char device[CMDBUFSIZE]; /* The remote device name. */ char login[CMDBUFSIZE]; /* The remote user name. */ char *sys, *dev, *user; /* For copying into the above buffers. */ + char *tar_rsh; sys = system; dev = device; @@ -370,19 +373,31 @@ __rmt_open (path, oflag, mode, bias) setuid (getuid ()); setgid (getgid ()); + tar_rsh = getenv("TAR_RSH"); + if (*login) { - execl ("/usr/bin/rsh", "rsh", "-l", login, system, - "/etc/rmt", (char *) 0); - execlp ("rsh", "rsh", "-l", login, system, - "/etc/rmt", (char *) 0); + if (tar_rsh) { + execlp (tar_rsh, tar_rsh, "-l", login, system, + "/etc/rmt", (char *) 0); + } else { + execl ("/usr/bin/rsh", "rsh", "-l", login, system, + "/etc/rmt", (char *) 0); + execlp ("rsh", "rsh", "-l", login, system, + "/etc/rmt", (char *) 0); + } } else { - execl ("/usr/bin/rsh", "rsh", system, - "/etc/rmt", (char *) 0); - execlp ("rsh", "rsh", system, - "/etc/rmt", (char *) 0); + if (tar_rsh) { + execlp (tar_rsh, tar_rsh, system, + "/etc/rmt", (char *) 0); + } else { + execl ("/usr/bin/rsh", "rsh", system, + "/etc/rmt", (char *) 0); + execlp ("rsh", "rsh", system, + "/etc/rmt", (char *) 0); + } } /* Bad problems if we get here. */ |