summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/rcmd.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1996-09-02 21:26:09 +0000
committermillert <millert@openbsd.org>1996-09-02 21:26:09 +0000
commit542c8643a7a6686bdf9f7b8424f62e4218eec46f (patch)
tree246ff3e244e951f4ed3972fbc1ff5eb4b4df343b /lib/libc/net/rcmd.c
parentNetBSD -> OpenBSD (diff)
downloadwireguard-openbsd-542c8643a7a6686bdf9f7b8424f62e4218eec46f.tar.xz
wireguard-openbsd-542c8643a7a6686bdf9f7b8424f62e4218eec46f.zip
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()) {