Error in port-forwarding in openssh-2.9p2


There seems to be something wrong with the port-forwarding code in openssh-2.9p2.

Symtoms

When trying eg "ssh -l <username> -R <remote port>:<local host>:<local port> <remote host>" it intead try to forward to 0.0.0.0 at port 0.

Solution

Apply the following patch
--- channels.c	2001/05/08 19:17:30	1.114
+++ channels.c	2001/05/09 22:46:11
@@ -771,8 +771,9 @@
 
 		rtype = (c->type == SSH_CHANNEL_RPORT_LISTENER) ?
 		    "forwarded-tcpip" : "direct-tcpip";
-		nextstate = (c->host_port == 0) ? SSH_CHANNEL_DYNAMIC :
-		    SSH_CHANNEL_OPENING;
+		nextstate = (c->host_port == 0 &&
+		    c->type != SSH_CHANNEL_RPORT_LISTENER) ?
+		    SSH_CHANNEL_DYNAMIC : SSH_CHANNEL_OPENING;
 
 		addrlen = sizeof(addr);
 		newsock = accept(c->sock, &addr, &addrlen);


Links

http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=98945256900402&w=2
Author Per-Olof Pettersson