components/openssh/patches/032-hang_on_closed_output.patch
author Jan Parcel <jan.parcel@oracle.com>
Mon, 01 Feb 2016 06:53:50 -0800
changeset 5376 4615bc2f4a50
parent 4976 0224a36cbe09
permissions -rw-r--r--
22631538 Patch comment incorrect/outdated for patch 039-sshd_config_5_defaults.patch

#
# Fix possible hang on closed output.
#
# When there is a connectivity problem between the server and the client
# (network outage, server crash or reboot), the client indefinitely hangs.
#
# This patch fixes the issue by checking ssh_packet_write_poll return value
# in ssh_packet_write_wait and passing it through.
#
# The (updated) patch has been accepted upstream and will be part of 7.2
# https://github.com/openssh/openssh-portable/commit/8408218
#
diff -pur old/packet.c new/packet.c
--- old/packet.c
+++ new/packet.c
@@ -2040,7 +2040,8 @@ ssh_packet_write_wait(struct ssh *ssh)
 	    NFDBITS), sizeof(fd_mask));
 	if (setp == NULL)
 		return SSH_ERR_ALLOC_FAIL;
-	ssh_packet_write_poll(ssh);
+	if ((r = ssh_packet_write_poll(ssh)) != 0)
+		return r;
 	while (ssh_packet_have_data_to_write(ssh)) {
 		memset(setp, 0, howmany(state->connection_out + 1,
 		    NFDBITS) * sizeof(fd_mask));