summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/rcmdsh.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-07-23 16:59:37 +0000
committermillert <millert@openbsd.org>1997-07-23 16:59:37 +0000
commit3b65d27bcad993a27388bf3f75c1127956fe510d (patch)
treed64e8642005d0ff8eceab5845828d6394c1374e2 /lib/libc/net/rcmdsh.c
parentA block of code from the last commit was not #ifdef NETATALK. (diff)
downloadwireguard-openbsd-3b65d27bcad993a27388bf3f75c1127956fe510d.tar.xz
wireguard-openbsd-3b65d27bcad993a27388bf3f75c1127956fe510d.zip
Don't do a gethostbyname() on "localhost" since we need it to
be unmolested when we test whether or not to use a local shell instead of rsh.
Diffstat (limited to 'lib/libc/net/rcmdsh.c')
-rw-r--r--lib/libc/net/rcmdsh.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c
index 39338c2c744..b2130fd2338 100644
--- a/lib/libc/net/rcmdsh.c
+++ b/lib/libc/net/rcmdsh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcmdsh.c,v 1.3 1996/09/15 09:31:17 tholo Exp $ */
+/* $OpenBSD: rcmdsh.c,v 1.4 1997/07/23 16:59:37 millert Exp $ */
/*
* This is an rcmd() replacement originally by
@@ -6,7 +6,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.3 1996/09/15 09:31:17 tholo Exp $";
+static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.4 1997/07/23 16:59:37 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -50,11 +50,13 @@ rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog)
}
/* Validate remote hostname. */
- if ((hp = gethostbyname(*ahost)) == NULL) {
- herror(*ahost);
- return(-1);
+ if (strcmp(*ahost, "localhost") != 0) {
+ if ((hp = gethostbyname(*ahost)) == NULL) {
+ herror(*ahost);
+ return(-1);
+ }
+ *ahost = hp->h_name;
}
- *ahost = hp->h_name;
/* Get a socketpair we'll use for stdin and stdout. */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) < 0) {