diff options
author | halex <> | 2015-03-23 22:29:32 +0000 |
---|---|---|
committer | halex <> | 2015-03-23 22:29:32 +0000 |
commit | 67fc215badd8535cee970d83424b03baed1c57f9 (patch) | |
tree | c5ca6bf2c43aa5e012c1ce770ae786cfd678c9ae | |
parent | c89070fe7b65c3f3a8a5c693ce3298a9598d1c02 (diff) | |
download | openbsd-67fc215badd8535cee970d83424b03baed1c57f9.tar.gz openbsd-67fc215badd8535cee970d83424b03baed1c57f9.tar.bz2 openbsd-67fc215badd8535cee970d83424b03baed1c57f9.zip |
Make rcmdsh(3) not fail if it is passed a non resolvable hostname.
Instead, silently ignore the fact and instead let the underlying
ssh (or $RSH) command handle it.
ok millert@
-rw-r--r-- | src/lib/libc/net/rcmd.3 | 13 | ||||
-rw-r--r-- | src/lib/libc/net/rcmdsh.3 | 12 | ||||
-rw-r--r-- | src/lib/libc/net/rcmdsh.c | 11 |
3 files changed, 16 insertions, 20 deletions
diff --git a/src/lib/libc/net/rcmd.3 b/src/lib/libc/net/rcmd.3 index b77e417b87..5fe1ee58eb 100644 --- a/src/lib/libc/net/rcmd.3 +++ b/src/lib/libc/net/rcmd.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: rcmd.3,v 1.31 2014/04/19 18:11:19 tedu Exp $ | 1 | .\" $OpenBSD: rcmd.3,v 1.32 2015/03/23 22:29:32 halex Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1983, 1991, 1993 | 3 | .\" Copyright (c) 1983, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -27,7 +27,7 @@ | |||
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
29 | .\" | 29 | .\" |
30 | .Dd $Mdocdate: April 19 2014 $ | 30 | .Dd $Mdocdate: March 23 2015 $ |
31 | .Dt RCMD 3 | 31 | .Dt RCMD 3 |
32 | .Os | 32 | .Os |
33 | .Sh NAME | 33 | .Sh NAME |
@@ -105,12 +105,11 @@ The | |||
105 | function looks up the host | 105 | function looks up the host |
106 | .Fa *ahost | 106 | .Fa *ahost |
107 | using | 107 | using |
108 | .Xr gethostbyname 3 , | 108 | .Xr gethostbyname 3 |
109 | returning \-1 if the host does not exist. | 109 | and, if the host exists, |
110 | Otherwise | ||
111 | .Fa *ahost | 110 | .Fa *ahost |
112 | is set to the standard name of the host | 111 | is set to the standard name of the host. |
113 | and a connection is established to a server | 112 | A connection is then established to a server |
114 | residing at the well-known Internet port | 113 | residing at the well-known Internet port |
115 | .Fa inport . | 114 | .Fa inport . |
116 | If the user is not the superuser, the only valid port is | 115 | If the user is not the superuser, the only valid port is |
diff --git a/src/lib/libc/net/rcmdsh.3 b/src/lib/libc/net/rcmdsh.3 index 702fb1d163..daf23bc3c0 100644 --- a/src/lib/libc/net/rcmdsh.3 +++ b/src/lib/libc/net/rcmdsh.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: rcmdsh.3,v 1.16 2014/04/19 18:11:19 tedu Exp $ | 1 | .\" $OpenBSD: rcmdsh.3,v 1.17 2015/03/23 22:29:32 halex Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1983, 1991, 1993 | 3 | .\" Copyright (c) 1983, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -27,7 +27,7 @@ | |||
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | .\" SUCH DAMAGE. | 28 | .\" SUCH DAMAGE. |
29 | .\" | 29 | .\" |
30 | .Dd $Mdocdate: April 19 2014 $ | 30 | .Dd $Mdocdate: March 23 2015 $ |
31 | .Dt RCMDSH 3 | 31 | .Dt RCMDSH 3 |
32 | .Os | 32 | .Os |
33 | .Sh NAME | 33 | .Sh NAME |
@@ -55,11 +55,11 @@ The | |||
55 | function looks up the host | 55 | function looks up the host |
56 | .Fa *ahost | 56 | .Fa *ahost |
57 | using | 57 | using |
58 | .Xr gethostbyname 3 , | 58 | .Xr gethostbyname 3 |
59 | returning \-1 if the host does not exist. | 59 | and, if the host exists, |
60 | Otherwise | ||
61 | .Fa *ahost | 60 | .Fa *ahost |
62 | is set to the standard name of the host and a connection is established to | 61 | is set to the standard name of the host. |
62 | A connection is then established to | ||
63 | a server residing at the well-known Internet port | 63 | a server residing at the well-known Internet port |
64 | .Li shell/tcp | 64 | .Li shell/tcp |
65 | (or whatever port is used by | 65 | (or whatever port is used by |
diff --git a/src/lib/libc/net/rcmdsh.c b/src/lib/libc/net/rcmdsh.c index 7404a6d597..ab86475c84 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.13 2014/04/24 18:56:24 jmc Exp $ */ | 1 | /* $OpenBSD: rcmdsh.c,v 1.14 2015/03/23 22:29:32 halex Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001, MagniComp | 4 | * Copyright (c) 2001, MagniComp |
@@ -74,12 +74,9 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, | |||
74 | 74 | ||
75 | /* Validate remote hostname. */ | 75 | /* Validate remote hostname. */ |
76 | if (strcmp(*ahost, "localhost") != 0) { | 76 | if (strcmp(*ahost, "localhost") != 0) { |
77 | if (((hp = gethostbyname2(*ahost, AF_INET)) == NULL) && | 77 | if ((hp = gethostbyname2(*ahost, AF_INET)) || |
78 | ((hp = gethostbyname2(*ahost, AF_INET6)) == NULL)) { | 78 | (hp = gethostbyname2(*ahost, AF_INET6))) |
79 | herror(*ahost); | 79 | *ahost = hp->h_name; |
80 | return(-1); | ||
81 | } | ||
82 | *ahost = hp->h_name; | ||
83 | } | 80 | } |
84 | 81 | ||
85 | /* Get a socketpair we'll use for stdin and stdout. */ | 82 | /* Get a socketpair we'll use for stdin and stdout. */ |