summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormillert <>1997-07-23 16:59:37 +0000
committermillert <>1997-07-23 16:59:37 +0000
commitae4be7efc430e0553bfdfcdb1dd9c4123cd9db5a (patch)
tree9570311c079b20701702a8fcd560597b5d9140aa /src
parent57d9396327509626d43515bbe9bb5ef94c0dad50 (diff)
downloadopenbsd-ae4be7efc430e0553bfdfcdb1dd9c4123cd9db5a.tar.gz
openbsd-ae4be7efc430e0553bfdfcdb1dd9c4123cd9db5a.tar.bz2
openbsd-ae4be7efc430e0553bfdfcdb1dd9c4123cd9db5a.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 'src')
-rw-r--r--src/lib/libc/net/rcmdsh.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libc/net/rcmdsh.c b/src/lib/libc/net/rcmdsh.c
index 39338c2c74..b2130fd233 100644
--- a/src/lib/libc/net/rcmdsh.c
+++ b/src/lib/libc/net/rcmdsh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rcmdsh.c,v 1.3 1996/09/15 09:31:17 tholo Exp $ */ 1/* $OpenBSD: rcmdsh.c,v 1.4 1997/07/23 16:59:37 millert Exp $ */
2 2
3/* 3/*
4 * This is an rcmd() replacement originally by 4 * This is an rcmd() replacement originally by
@@ -6,7 +6,7 @@
6 */ 6 */
7 7
8#if defined(LIBC_SCCS) && !defined(lint) 8#if defined(LIBC_SCCS) && !defined(lint)
9static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.3 1996/09/15 09:31:17 tholo Exp $"; 9static char *rcsid = "$OpenBSD: rcmdsh.c,v 1.4 1997/07/23 16:59:37 millert Exp $";
10#endif /* LIBC_SCCS and not lint */ 10#endif /* LIBC_SCCS and not lint */
11 11
12#include <sys/types.h> 12#include <sys/types.h>
@@ -50,11 +50,13 @@ rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog)
50 } 50 }
51 51
52 /* Validate remote hostname. */ 52 /* Validate remote hostname. */
53 if ((hp = gethostbyname(*ahost)) == NULL) { 53 if (strcmp(*ahost, "localhost") != 0) {
54 herror(*ahost); 54 if ((hp = gethostbyname(*ahost)) == NULL) {
55 return(-1); 55 herror(*ahost);
56 return(-1);
57 }
58 *ahost = hp->h_name;
56 } 59 }
57 *ahost = hp->h_name;
58 60
59 /* Get a socketpair we'll use for stdin and stdout. */ 61 /* Get a socketpair we'll use for stdin and stdout. */
60 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) < 0) { 62 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sp) < 0) {