summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalex <>2015-03-23 22:29:32 +0000
committerhalex <>2015-03-23 22:29:32 +0000
commit67fc215badd8535cee970d83424b03baed1c57f9 (patch)
treec5ca6bf2c43aa5e012c1ce770ae786cfd678c9ae
parentc89070fe7b65c3f3a8a5c693ce3298a9598d1c02 (diff)
downloadopenbsd-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.313
-rw-r--r--src/lib/libc/net/rcmdsh.312
-rw-r--r--src/lib/libc/net/rcmdsh.c11
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
105function looks up the host 105function looks up the host
106.Fa *ahost 106.Fa *ahost
107using 107using
108.Xr gethostbyname 3 , 108.Xr gethostbyname 3
109returning \-1 if the host does not exist. 109and, if the host exists,
110Otherwise
111.Fa *ahost 110.Fa *ahost
112is set to the standard name of the host 111is set to the standard name of the host.
113and a connection is established to a server 112A connection is then established to a server
114residing at the well-known Internet port 113residing at the well-known Internet port
115.Fa inport . 114.Fa inport .
116If the user is not the superuser, the only valid port is 115If 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
55function looks up the host 55function looks up the host
56.Fa *ahost 56.Fa *ahost
57using 57using
58.Xr gethostbyname 3 , 58.Xr gethostbyname 3
59returning \-1 if the host does not exist. 59and, if the host exists,
60Otherwise
61.Fa *ahost 60.Fa *ahost
62is set to the standard name of the host and a connection is established to 61is set to the standard name of the host.
62A connection is then established to
63a server residing at the well-known Internet port 63a 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. */