From f0501ff72b5f3b90c0e66ff5d1b886771089af38 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 15 Dec 2020 23:11:54 -0600 Subject: [PATCH] SSH2: get_binary_packet() doesn't know about channel type --- phpseclib/Net/SSH2.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index ce007b06..fb458466 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3392,9 +3392,6 @@ class Net_SSH2 // on windows this returns a "Warning: Invalid CRT parameters detected" error if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) { $this->is_timeout = true; - if ($client_channel == NET_SSH2_CHANNEL_EXEC && !$this->request_pty) { - $this->_close_channel($client_channel); - } return true; } $elapsed = strtok(microtime(), ' ') + strtok('') - $start; @@ -3764,6 +3761,9 @@ class Net_SSH2 $this->binary_packet_buffer = false; } else { $response = $this->_get_binary_packet(true); + if ($response === true && $this->is_timeout && $client_channel == NET_SSH2_CHANNEL_EXEC && !$this->request_pty) { + $this->_close_channel($client_channel); + } if ($response === false) { $this->bitmap = 0; user_error('Connection closed by server');