summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Hall <halex@cvs.openbsd.org>2015-03-23 22:29:33 +0000
committerAlexander Hall <halex@cvs.openbsd.org>2015-03-23 22:29:33 +0000
commitddef5118e2d4748a45d360d7175fb7aea220e385 (patch)
tree75408b08e6495c8f449880da0487b4c348afac09
parentaed228c761d9dd414895329f7383a01c5fc7c3f2 (diff)
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--lib/libc/net/rcmd.313
-rw-r--r--lib/libc/net/rcmdsh.312
-rw-r--r--lib/libc/net/rcmdsh.c11
3 files changed, 16 insertions, 20 deletions
diff --git a/lib/libc/net/rcmd.3 b/lib/libc/net/rcmd.3
index b77e417b87e..5fe1ee58eb3 100644
--- a/lib/libc/net/rcmd.3
+++ b/lib/libc/net/rcmd.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rcmd.3,v 1.31 2014/04/19 18:11:19 tedu Exp $
+.\" $OpenBSD: rcmd.3,v 1.32 2015/03/23 22:29:32 halex Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: April 19 2014 $
+.Dd $Mdocdate: March 23 2015 $
.Dt RCMD 3
.Os
.Sh NAME
@@ -105,12 +105,11 @@ The
function looks up the host
.Fa *ahost
using
-.Xr gethostbyname 3 ,
-returning \-1 if the host does not exist.
-Otherwise
+.Xr gethostbyname 3
+and, if the host exists,
.Fa *ahost
-is set to the standard name of the host
-and a connection is established to a server
+is set to the standard name of the host.
+A connection is then established to a server
residing at the well-known Internet port
.Fa inport .
If the user is not the superuser, the only valid port is
diff --git a/lib/libc/net/rcmdsh.3 b/lib/libc/net/rcmdsh.3
index 702fb1d1631..daf23bc3c00 100644
--- a/lib/libc/net/rcmdsh.3
+++ b/lib/libc/net/rcmdsh.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rcmdsh.3,v 1.16 2014/04/19 18:11:19 tedu Exp $
+.\" $OpenBSD: rcmdsh.3,v 1.17 2015/03/23 22:29:32 halex Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: April 19 2014 $
+.Dd $Mdocdate: March 23 2015 $
.Dt RCMDSH 3
.Os
.Sh NAME
@@ -55,11 +55,11 @@ The
function looks up the host
.Fa *ahost
using
-.Xr gethostbyname 3 ,
-returning \-1 if the host does not exist.
-Otherwise
+.Xr gethostbyname 3
+and, if the host exists,
.Fa *ahost
-is set to the standard name of the host and a connection is established to
+is set to the standard name of the host.
+A connection is then established to
a server residing at the well-known Internet port
.Li shell/tcp
(or whatever port is used by
diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c
index 7404a6d5979..ab86475c84d 100644
--- a/lib/libc/net/rcmdsh.c
+++ b/lib/libc/net/rcmdsh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcmdsh.c,v 1.13 2014/04/24 18:56:24 jmc Exp $ */
+/* $OpenBSD: rcmdsh.c,v 1.14 2015/03/23 22:29:32 halex Exp $ */
/*
* Copyright (c) 2001, MagniComp
@@ -74,12 +74,9 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser,
/* Validate remote hostname. */
if (strcmp(*ahost, "localhost") != 0) {
- if (((hp = gethostbyname2(*ahost, AF_INET)) == NULL) &&
- ((hp = gethostbyname2(*ahost, AF_INET6)) == NULL)) {
- herror(*ahost);
- return(-1);
- }
- *ahost = hp->h_name;
+ if ((hp = gethostbyname2(*ahost, AF_INET)) ||
+ (hp = gethostbyname2(*ahost, AF_INET6)))
+ *ahost = hp->h_name;
}
/* Get a socketpair we'll use for stdin and stdout. */