NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/52604: current ssh cannot forward x11 session.



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

  *** 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@localhost:/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@localhost")) != 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

>Unformatted:
 	
 	



Home | Main Index | Thread Index | Old Index