From nobody@FreeBSD.org  Fri Apr 19 03:28:33 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 2742E37B416
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Apr 2002 03:28:32 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g3JASW685838;
	Fri, 19 Apr 2002 03:28:32 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200204191028.g3JASW685838@freefall.freebsd.org>
Date: Fri, 19 Apr 2002 03:28:32 -0700 (PDT)
From: Petr Rehor <petr.rehor@i.cz>
To: freebsd-gnats-submit@FreeBSD.org
Subject: OpenSSH -R port forwarding works with ssh v1 but not with ssh v2
X-Send-Pr-Version: www-1.0

>Number:         37245
>Category:       bin
>Synopsis:       OpenSSH -R port forwarding works with ssh v1 but not with ssh v2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 19 03:30:02 PDT 2002
>Closed-Date:    Sun Jul 07 09:53:58 PDT 2002
>Last-Modified:  Sun Jul 07 09:53:58 PDT 2002
>Originator:     Petr Rehor
>Release:        FreeBSD 4.5-RELEASE-p2 i386
>Organization:
ICZ Czech Republic
>Environment:
FreeBSD noc.decros.cz 4.5-RELEASE-p2 FreeBSD 4.5-RELEASE-p2 #0: Fri Mar  8 22:22:02 CET 2002     reho@noc.decros.cz:/usr/obj/usr/src/sys/NOC  i386

>Description:
OpenSSH 2.9 -R port forwarding works with ssh v1 but not with ssh v2. -L port forwarding works for both protocols. It's fixes in OpenSSH

See:
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=75341+0+archive/2002/freebsd-security/20020113.freebsd-security
http://www.freebsd.org/cgi/getmsg.cgi?fetch=81207+83038+/usr/local/www/db/text/2002/freebsd-security/20020113.freebsd-security

Patch available from:
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/channels.c.diff?r1=1.109.2.1&r2=1.109.2.2
>How-To-Repeat:
ssh -2 -R PORT:localhost:PORT remote

>Fix:
===================================================================
RCS file: /usr/OpenBSD/cvs/src/usr.bin/ssh/channels.c,v
retrieving revision 1.109.2.1
retrieving revision 1.109.2.2
diff -u -r1.109.2.1 -r1.109.2.2
--- src/usr.bin/ssh/channels.c	2001/06/12 22:31:48	1.109.2.1
+++ src/usr.bin/ssh/channels.c	2001/06/21 23:45:23	1.109.2.2
@@ -40,7 +40,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.109.2.1 2001/06/12 22:31:48 jason Exp $");
+RCSID("$OpenBSD: channels.c,v 1.109.2.2 2001/06/21 23:45:23 jason Exp $");
 
 #include <openssl/rsa.h>
 #include <openssl/dsa.h>
@@ -773,8 +773,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);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jon 
State-Changed-When: Sun Jul 7 09:53:11 PDT 2002 
State-Changed-Why:  

openssh now upgraded 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37245 
>Unformatted:
