summaryrefslogtreecommitdiff
path: root/lib/libc/net
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-07-23 16:59:38 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-07-23 16:59:38 +0000
commitb484c1778d5bf2e1454f826fb863b1797ca8bf71 (patch)
treeac50a0fd51c3c2ca6d2afc369697d2d58b617ae8 /lib/libc/net
parent7112852f5de062ea9bdfce13107b2643945efdbd (diff)
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')
-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) {