From 9015d987f7d9fbd9d307fce89504d91dc89a8dca Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 12 Jul 2019 07:36:12 -0500 Subject: [PATCH 1/3] 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; From 9f1287e68b3f283339a9f98f67515dd619e5bf9d Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 12 Jul 2019 07:53:49 -0500 Subject: [PATCH 2/3] SSH2: update constant for last commit --- phpseclib/Net/SSH2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index bcb25cde..817fa165 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3712,7 +3712,7 @@ class 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) { + if ($client_channel == self::CHANNEL_EXEC && !$this->request_pty) { $this->_close_channel($client_channel); } return true; @@ -3762,7 +3762,7 @@ class SSH2 switch ($type) { case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: /* - if ($client_channel == NET_SSH2_CHANNEL_EXEC) { + if ($client_channel == self::CHANNEL_EXEC) { $this->_send_channel_packet($client_channel, chr(0)); } */ From d448dba5a1d72f5e6f8b1fb158b4b0beb260b429 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 14 Jul 2019 10:52:24 -0500 Subject: [PATCH 3/3] Travis: allow failures on 7.4snapshot --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 293619f2..1f19d644 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ before_install: true matrix: allow_failures: - php: nightly + - 7.4snapshot install: - wget http://ftp.gnu.org/gnu/parallel/parallel-20170822.tar.bz2