- djm@cvs.openbsd.org 2013/12/19 01:04:36

[channels.c]
     bz#2147: fix multiple remote forwardings with dynamically assigned
     listen ports. In the s->c message to open the channel we were sending
     zero (the magic number to request a dynamic port) instead of the actual
     listen port. The client therefore had no way of discriminating between
     them.

     Diagnosis and fix by ronf AT timeheart.net
This commit is contained in:
Damien Miller 2013-12-29 17:45:26 +11:00
parent bf25d114e2
commit 4def184e9b
2 changed files with 16 additions and 4 deletions

View File

@ -14,6 +14,15 @@
- djm@cvs.openbsd.org 2013/12/19 00:27:57 - djm@cvs.openbsd.org 2013/12/19 00:27:57
[auth-options.c] [auth-options.c]
simplify freeing of source-address certificate restriction simplify freeing of source-address certificate restriction
- djm@cvs.openbsd.org 2013/12/19 01:04:36
[channels.c]
bz#2147: fix multiple remote forwardings with dynamically assigned
listen ports. In the s->c message to open the channel we were sending
zero (the magic number to request a dynamic port) instead of the actual
listen port. The client therefore had no way of discriminating between
them.
Diagnosis and fix by ronf AT timeheart.net
20131221 20131221
- (dtucker) [regress/keytype.sh] Actually test ecdsa key types. - (dtucker) [regress/keytype.sh] Actually test ecdsa key types.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: channels.c,v 1.327 2013/11/08 00:39:15 djm Exp $ */ /* $OpenBSD: channels.c,v 1.328 2013/12/19 01:04:36 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -1385,6 +1385,8 @@ port_open_helper(Channel *c, char *rtype)
{ {
int direct; int direct;
char buf[1024]; char buf[1024];
char *local_ipaddr = get_local_ipaddr(c->sock);
int local_port = get_sock_port(c->sock, 1);
char *remote_ipaddr = get_peer_ipaddr(c->sock); char *remote_ipaddr = get_peer_ipaddr(c->sock);
int remote_port = get_peer_port(c->sock); int remote_port = get_peer_port(c->sock);
@ -1399,9 +1401,9 @@ port_open_helper(Channel *c, char *rtype)
snprintf(buf, sizeof buf, snprintf(buf, sizeof buf,
"%s: listening port %d for %.100s port %d, " "%s: listening port %d for %.100s port %d, "
"connect from %.200s port %d", "connect from %.200s port %d to %.100s port %d",
rtype, c->listening_port, c->path, c->host_port, rtype, c->listening_port, c->path, c->host_port,
remote_ipaddr, remote_port); remote_ipaddr, remote_port, local_ipaddr, local_port);
free(c->remote_name); free(c->remote_name);
c->remote_name = xstrdup(buf); c->remote_name = xstrdup(buf);
@ -1419,7 +1421,7 @@ port_open_helper(Channel *c, char *rtype)
} else { } else {
/* listen address, port */ /* listen address, port */
packet_put_cstring(c->path); packet_put_cstring(c->path);
packet_put_int(c->listening_port); packet_put_int(local_port);
} }
/* originator host and port */ /* originator host and port */
packet_put_cstring(remote_ipaddr); packet_put_cstring(remote_ipaddr);
@ -1436,6 +1438,7 @@ port_open_helper(Channel *c, char *rtype)
packet_send(); packet_send();
} }
free(remote_ipaddr); free(remote_ipaddr);
free(local_ipaddr);
} }
static void static void