summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-06-05 15:13:14 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-06-05 15:13:14 +0000
commit4131bdc9c0da0aea12bce891d2fdb8d92bc732d2 (patch)
tree13f4152f372488428fcaa462bb05fbc01587333b /usr.bin/ssh
parentd29f8267e5fbf298f4cbaeaa63d63b14c9aa85c0 (diff)
For "ssh -L 12345:/tmp/sock" don't fail with "No forward host name."
(we have a path, not a host name). Based on a diff from Jared Yanovich. OK djm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/channels.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index 0b597e4b583..68e9c3509e5 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.343 2015/05/08 03:25:07 dtucker Exp $ */
+/* $OpenBSD: channels.c,v 1.344 2015/06/05 15:13:13 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2778,17 +2778,21 @@ channel_setup_fwd_listener_tcpip(int type, struct Forward *fwd,
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
in_port_t *lport_p;
- host = (type == SSH_CHANNEL_RPORT_LISTENER) ?
- fwd->listen_host : fwd->connect_host;
is_client = (type == SSH_CHANNEL_PORT_LISTENER);
- if (host == NULL) {
- error("No forward host name.");
- return 0;
- }
- if (strlen(host) >= NI_MAXHOST) {
- error("Forward host name too long.");
- return 0;
+ if (is_client && fwd->connect_path != NULL) {
+ host = fwd->connect_path;
+ } else {
+ host = (type == SSH_CHANNEL_RPORT_LISTENER) ?
+ fwd->listen_host : fwd->connect_host;
+ if (host == NULL) {
+ error("No forward host name.");
+ return 0;
+ }
+ if (strlen(host) >= NI_MAXHOST) {
+ error("Forward host name too long.");
+ return 0;
+ }
}
/* Determine the bind address, cf. channel_fwd_bind_addr() comment */