From 309fa0af4429e87d1948655ddb4b5cde0b45fbff Mon Sep 17 00:00:00 2001 From: terrafrost Date: Thu, 23 Nov 2017 09:31:34 -0600 Subject: [PATCH] SSH/SFTP: more adustments to channel handling --- phpseclib/Net/SFTP.php | 10 +++++----- phpseclib/Net/SSH2.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index a0b36323..3f386522 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -478,7 +478,7 @@ class Net_SFTP extends Net_SSH2 $this->channel_status[NET_SFTP_CHANNEL] = NET_SSH2_MSG_CHANNEL_OPEN; - $response = $this->_get_channel_packet(NET_SFTP_CHANNEL); + $response = $this->_get_channel_packet(NET_SFTP_CHANNEL, true); if ($response === false) { return false; } @@ -499,7 +499,7 @@ class Net_SFTP extends Net_SSH2 $this->channel_status[NET_SFTP_CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; - $response = $this->_get_channel_packet(NET_SFTP_CHANNEL); + $response = $this->_get_channel_packet(NET_SFTP_CHANNEL, true); if ($response === false) { // from PuTTY's psftp.exe $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n" . @@ -523,7 +523,7 @@ class Net_SFTP extends Net_SSH2 $this->channel_status[NET_SFTP_CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; - $response = $this->_get_channel_packet(NET_SFTP_CHANNEL); + $response = $this->_get_channel_packet(NET_SFTP_CHANNEL, true); if ($response === false) { return false; } @@ -3027,7 +3027,7 @@ class Net_SFTP extends Net_SSH2 // SFTP packet length while (strlen($this->packet_buffer) < 4) { - $temp = $this->_get_channel_packet(NET_SFTP_CHANNEL); + $temp = $this->_get_channel_packet(NET_SFTP_CHANNEL, true); if (is_bool($temp)) { $this->packet_type = false; $this->packet_buffer = ''; @@ -3044,7 +3044,7 @@ class Net_SFTP extends Net_SSH2 // SFTP packet type and data payload while ($tempLength > 0) { - $temp = $this->_get_channel_packet(NET_SFTP_CHANNEL); + $temp = $this->_get_channel_packet(NET_SFTP_CHANNEL, true); if (is_bool($temp)) { $this->packet_type = false; $this->packet_buffer = ''; diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 76683827..bdce0715 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3740,7 +3740,7 @@ class Net_SSH2 $data = $this->_string_shift($response, $length); $this->stdErrorLog.= $data; if ($skip_extended || $this->quiet_mode) { - break; + continue; } if ($client_channel == $channel && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA) { return $data;