From 329d3e2a15627df98ce19fb4e191875bdf5f05e7 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 5 Mar 2012 02:06:13 +0000 Subject: [PATCH] - send a NET_SSH2_MSG_CHANNEL_CLOSE packet in addition to a NET_SSH2_MSG_CHANNEL_EOF packet when force closing the channel (thanks, ferus!) git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@197 21d32557-59b3-4da0-833f-c5933fad653e --- phpseclib/Net/SSH2.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 90a31034..17e490cd 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2123,9 +2123,7 @@ class Net_SSH2 { return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION); } case NET_SSH2_MSG_CHANNEL_CLOSE: - $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); - return $type != NET_SSH2_MSG_CHANNEL_CLOSE; - + return $type == NET_SSH2_MSG_CHANNEL_CLOSE ? true : $this->_get_channel_packet($client_channel, $skip_extended); } switch ($type) { @@ -2350,12 +2348,9 @@ class Net_SSH2 { { // see http://tools.ietf.org/html/rfc4254#section-5.3 - $packet = pack('CN', - NET_SSH2_MSG_CHANNEL_EOF, - $this->server_channels[$client_channel]); - if (!$this->_send_binary_packet($packet)) { - return false; - } + $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$channel])); + + $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); $this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE;