NetBSD Problem Report #52604

From tacha@trun.org  Mon Oct  9 04:04:47 2017
Return-Path: <tacha@trun.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 39DF87A25E
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  9 Oct 2017 04:04:47 +0000 (UTC)
Message-Id: <20171009023112.BA061218F3@tamp.trun.org>
Date: Mon,  9 Oct 2017 11:31:12 +0900 (JST)
From: tacha@trun.org
Reply-To: tacha@trun.org
To: gnats-bugs@NetBSD.org
Subject: current ssh cannot forward x11 session.
X-Send-Pr-Version: 3.95

>Number:         52604
>Category:       bin
>Synopsis:       current ssh cannot forward x11 session.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 09 04:05:00 +0000 2017
>Closed-Date:    Mon Jun 04 14:03:23 +0000 2018
>Last-Modified:  Mon Jun 04 14:03:23 +0000 2018
>Originator:     tacha@trun.org
>Release:        NetBSD 8.99.3
>Organization:
-----            : Tatoku Ogaito
   / _  _ |_  _  : Dept. Medical Informatics, University of Fukui
  / (_|(_ | )(_| : E-mail: tacha@tack.fukui-med.ac.jp tacha@NetBSD.org

  *** NetBSD: It'll be there when you're ready for it. ***
>Environment:


System: NetBSD tamp.trun.org 8.99.3 NetBSD 8.99.3 (TPX220-1.67) #116: Sun Oct 8 14:35:46 JST 2017 tacha@tamp.trun.org:/usr/current/src/sys/arch/amd64/compile/obj.amd64/TPX220 amd64
Architecture: x86_64
Machine: amd64
>Description:
	new ssh cannot open x11 session.

>How-To-Repeat:
	do "ssh -X remote_host remote_command" on X.
>Fix:
	Since ssh_packet_write_wait returns bytes_sent,
	its return values should be checked negative or not,
	and its error should be reported via  sshpkt_fatal().

Index: openssh/dist/channels.c
===================================================================
RCS file: /cvsroot/NetBSD-cvs/main/src/crypto/external/bsd/openssh/dist/channels.c,v
retrieving revision 1.19
diff -u -r1.19 channels.c
--- openssh/dist/channels.c	7 Oct 2017 19:39:19 -0000	1.19
+++ openssh/dist/channels.c	9 Oct 2017 02:04:26 -0000
@@ -3733,10 +3733,11 @@
 		    "streamlocal-forward@openssh.com")) != 0 ||
 		    (r = sshpkt_put_u8(ssh, 1)) != 0 || /* want reply */
 		    (r = sshpkt_put_cstring(ssh, fwd->listen_path)) != 0 ||
-		    (r = sshpkt_send(ssh)) != 0 ||
-		    (r = ssh_packet_write_wait(ssh)) != 0)
+		    (r = sshpkt_send(ssh)) != 0)
 			fatal("%s: request streamlocal: %s",
 			    __func__, ssh_err(r));
+		if ((r = ssh_packet_write_wait(ssh)) < 0)
+			sshpkt_fatal(ssh, __func__, r);
 	} else {
 		if ((r = sshpkt_start(ssh, SSH2_MSG_GLOBAL_REQUEST)) != 0 ||
 		    (r = sshpkt_put_cstring(ssh, "tcpip-forward")) != 0 ||
@@ -3744,10 +3745,11 @@
 		    (r = sshpkt_put_cstring(ssh,
 		    channel_rfwd_bind_host(fwd->listen_host))) != 0 ||
 		    (r = sshpkt_put_u32(ssh, fwd->listen_port)) != 0 ||
-		    (r = sshpkt_send(ssh)) != 0 ||
-		    (r = ssh_packet_write_wait(ssh)) != 0)
+		    (r = sshpkt_send(ssh)) != 0)
 			fatal("%s: request tcpip-forward: %s",
 			    __func__, ssh_err(r));
+		if ((r = ssh_packet_write_wait(ssh)) < 0)
+			sshpkt_fatal(ssh, __func__, r);
 	}
 	/* Assume that server accepts the request */
 	success = 1;
@@ -4691,8 +4693,11 @@
 	    (r = sshpkt_put_cstring(ssh, proto)) != 0 ||
 	    (r = sshpkt_put_cstring(ssh, new_data)) != 0 ||
 	    (r = sshpkt_put_u32(ssh, screen_number)) != 0 ||
-	    (r = sshpkt_send(ssh)) != 0 ||
-	    (r = ssh_packet_write_wait(ssh)) != 0)
+	    (r = sshpkt_send(ssh)) != 0)
 		fatal("%s: send x11-req: %s", __func__, ssh_err(r));
+
+	if ((r = ssh_packet_write_wait(ssh)) < 0)
+		sshpkt_fatal(ssh, __func__, r);
+
 	free(new_data);
 }
Index: openssh/dist/packet.c
===================================================================
RCS file: /cvsroot/NetBSD-cvs/main/src/crypto/external/bsd/openssh/dist/packet.c,v
retrieving revision 1.28
diff -u -r1.28 packet.c
--- openssh/dist/packet.c	7 Oct 2017 19:39:19 -0000	1.28
+++ openssh/dist/packet.c	9 Oct 2017 02:05:30 -0000
@@ -1779,9 +1779,10 @@
 	    (r = sshpkt_put_u8(ssh, 0)) != 0 || /* always display */
 	    (r = sshpkt_put_cstring(ssh, buf)) != 0 ||
 	    (r = sshpkt_put_cstring(ssh, "")) != 0 ||
-	    (r = sshpkt_send(ssh)) != 0 ||
-	    (r = ssh_packet_write_wait(ssh)) != 0)
+	    (r = sshpkt_send(ssh)) != 0)
 		fatal("%s: %s", __func__, ssh_err(r));
+	if ((r = ssh_packet_write_wait(ssh)) < 0)
+		sshpkt_fatal(ssh, __func__, r);
 }

 static void

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52604 CVS commit: src/crypto/external/bsd/openssh/dist
Date: Mon, 9 Oct 2017 08:07:03 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Oct  9 12:07:03 UTC 2017

 Modified Files:
 	src/crypto/external/bsd/openssh/dist: channels.c packet.c

 Log Message:
 PR/52604: Tatoku Ogaito: Fix x11 session forwarding.


 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.20 src/crypto/external/bsd/openssh/dist/channels.c
 cvs rdiff -u -r1.28 -r1.29 src/crypto/external/bsd/openssh/dist/packet.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 04 Jun 2018 11:19:55 +0000
State-Changed-Why:
Hi, does it work now?
(I assume this also needs to be pulled up)


From: Tatoku Ogaito <tacha@tack.m.cii.u-fukui.ac.jp>
To: gnats-bugs@NetBSD.org, maya@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/52604 (current ssh cannot forward x11 session.)
Date: Mon, 04 Jun 2018 20:42:08 +0900 (JST)

 Hi.

 The current ssh does work like a charm.
 # Actually I forgot that I have reported this bug.

 Please close the PR.

 The source files in netbsd-8 src tree has been
 fixed by the ticket 320.

 Thanks.

 Tacha

 >> In Message <20180604111955.D9A3A7A214@mollari.NetBSD.org>
  at Mon,  4 Jun 2018 11:19:55 +0000 (UTC)
  maya@NetBSD.org wrote:

  > Synopsis: current ssh cannot forward x11 session.
  > 
  > State-Changed-From-To: open->feedback
  > State-Changed-By: maya@NetBSD.org
  > State-Changed-When: Mon, 04 Jun 2018 11:19:55 +0000
  > State-Changed-Why:
  > Hi, does it work now?
  > (I assume this also needs to be pulled up)
  > 
  > 
  > 

State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 04 Jun 2018 14:03:23 +0000
State-Changed-Why:
Confirmed fixed. Thanks for the quick feeedback.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.