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.

Modified files:

Index: src/crypto/external/bsd/openssh/dist/channels.c
diff -u src/crypto/external/bsd/openssh/dist/channels.c:1.19 src/crypto/external/bsd/openssh/dist/channels.c:1.20
--- src/crypto/external/bsd/openssh/dist/channels.c:1.19	Sat Oct  7 15:39:19 2017
+++ src/crypto/external/bsd/openssh/dist/channels.c	Mon Oct  9 08:07:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: channels.c,v 1.19 2017/10/07 19:39:19 christos Exp $	*/
+/*	$NetBSD: channels.c,v 1.20 2017/10/09 12:07:03 christos Exp $	*/
 /* $OpenBSD: channels.c,v 1.375 2017/09/24 13:45:34 djm Exp $ */
 /*
  * Author: Tatu Ylonen <[email protected]>
@@ -41,7 +41,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: channels.c,v 1.19 2017/10/07 19:39:19 christos Exp $");
+__RCSID("$NetBSD: channels.c,v 1.20 2017/10/09 12:07:03 christos Exp $");
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3733,10 +3733,11 @@ channel_request_remote_forwarding(struct
 		    "[email protected]")) != 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 @@ channel_request_remote_forwarding(struct
 		    (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 @@ x11_request_forwarding_with_spoofing(str
 	    (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: src/crypto/external/bsd/openssh/dist/packet.c
diff -u src/crypto/external/bsd/openssh/dist/packet.c:1.28 src/crypto/external/bsd/openssh/dist/packet.c:1.29
--- src/crypto/external/bsd/openssh/dist/packet.c:1.28	Sat Oct  7 15:39:19 2017
+++ src/crypto/external/bsd/openssh/dist/packet.c	Mon Oct  9 08:07:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: packet.c,v 1.28 2017/10/07 19:39:19 christos Exp $	*/
+/*	$NetBSD: packet.c,v 1.29 2017/10/09 12:07:03 christos Exp $	*/
 /* $OpenBSD: packet.c,v 1.264 2017/09/12 06:32:07 djm Exp $ */
 /*
  * Author: Tatu Ylonen <[email protected]>
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: packet.c,v 1.28 2017/10/07 19:39:19 christos Exp $");
+__RCSID("$NetBSD: packet.c,v 1.29 2017/10/09 12:07:03 christos Exp $");
 
 #include <sys/param.h>	/* MIN roundup */
 #include <sys/types.h>
@@ -1779,9 +1779,10 @@ ssh_packet_send_debug(struct ssh *ssh, c
 	    (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

Reply via email to