From 9015d987f7d9fbd9d307fce89504d91dc89a8dca Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 12 Jul 2019 07:36:12 -0500 Subject: [PATCH] only auto close the channel for exec() timeouts --- phpseclib/Net/SSH2.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 04e25426..fdc1da40 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3815,7 +3815,9 @@ 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; - $this->_close_channel($client_channel); + if ($client_channel == NET_SSH2_CHANNEL_EXEC && !$this->request_pty) { + $this->_close_channel($client_channel); + } return true; } $elapsed = strtok(microtime(), ' ') + strtok('') - $start;