summaryrefslogtreecommitdiff
path: root/lib/libc/net/rcmd.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-09-02 21:26:10 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-09-02 21:26:10 +0000
commit725e98c9b80c026cc881f47e7e5a4bad384c21f2 (patch)
treed60e65053cfde1241bf0830528973e3b5ca46018 /lib/libc/net/rcmd.c
parent12dfdc56b5b94160a4a1140de985dabf3b6f38e0 (diff)
Looks at RSH envariable and calls rcmdsh() with that value if set.
Diffstat (limited to 'lib/libc/net/rcmd.c')
-rw-r--r--lib/libc/net/rcmd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index df555a51d68..44c516da040 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmd.c,v 1.15 1996/09/01 18:31:29 deraadt Exp $";
+static char *rcsid = "$OpenBSD: rcmd.c,v 1.16 1996/09/02 21:26:09 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -72,7 +72,16 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
int oldmask;
pid_t pid;
int s, lport, timo;
- char c;
+ char c, *p;
+
+ /* call rcmdsh() with specified remote shell if appropriate. */
+ if ((p = getenv("RSH"))) {
+ struct servent *sp = getservbyname("shell", "tcp");
+
+ if (sp && sp->s_port == rport)
+ return (rcmdsh(ahost, rport, locuser, remuser,
+ cmd, p));
+ }
/* use rsh(1) if non-root and remote port is shell. */
if (geteuid()) {