From 167d8a13655a3f61cc8160a3a242c02c41c82685 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 8 Sep 2020 11:00:09 +0545 Subject: [PATCH] Update phpseclib/phpseclib (2.0.28 => 2.0.29) in apps/files_external/3rdparty --- apps/files_external/3rdparty/composer.lock | 11 ++--- .../3rdparty/composer/installed.json | 13 +++-- .../3rdparty/phpseclib/phpseclib/README.md | 2 +- .../phpseclib/phpseclib/composer.json | 1 - .../phpseclib/phpseclib/Crypt/RSA.php | 2 + .../phpseclib/phpseclib/File/X509.php | 4 +- .../phpseclib/phpseclib/Net/SFTP.php | 48 ++++++++++++++++++- .../phpseclib/phpseclib/Net/SSH2.php | 28 ++++++----- 8 files changed, 81 insertions(+), 28 deletions(-) diff --git a/apps/files_external/3rdparty/composer.lock b/apps/files_external/3rdparty/composer.lock index d4cd3dccbe43..b32f0cb37f32 100644 --- a/apps/files_external/3rdparty/composer.lock +++ b/apps/files_external/3rdparty/composer.lock @@ -598,16 +598,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.28", + "version": "2.0.29", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "d1ca58cf33cb21046d702ae3a7b14fdacd9f3260" + "reference": "497856a8d997f640b4a516062f84228a772a48a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d1ca58cf33cb21046d702ae3a7b14fdacd9f3260", - "reference": "d1ca58cf33cb21046d702ae3a7b14fdacd9f3260", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/497856a8d997f640b4a516062f84228a772a48a8", + "reference": "497856a8d997f640b4a516062f84228a772a48a8", "shasum": "" }, "require": { @@ -616,7 +616,6 @@ "require-dev": { "phing/phing": "~2.7", "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "sami/sami": "~2.0", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { @@ -686,7 +685,7 @@ "x.509", "x509" ], - "time": "2020-07-08T09:08:33+00:00" + "time": "2020-09-08T04:24:43+00:00" }, { "name": "psr/cache", diff --git a/apps/files_external/3rdparty/composer/installed.json b/apps/files_external/3rdparty/composer/installed.json index 789d75635112..f5d9aaf5fe6a 100644 --- a/apps/files_external/3rdparty/composer/installed.json +++ b/apps/files_external/3rdparty/composer/installed.json @@ -613,17 +613,17 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.28", - "version_normalized": "2.0.28.0", + "version": "2.0.29", + "version_normalized": "2.0.29.0", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "d1ca58cf33cb21046d702ae3a7b14fdacd9f3260" + "reference": "497856a8d997f640b4a516062f84228a772a48a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d1ca58cf33cb21046d702ae3a7b14fdacd9f3260", - "reference": "d1ca58cf33cb21046d702ae3a7b14fdacd9f3260", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/497856a8d997f640b4a516062f84228a772a48a8", + "reference": "497856a8d997f640b4a516062f84228a772a48a8", "shasum": "" }, "require": { @@ -632,7 +632,6 @@ "require-dev": { "phing/phing": "~2.7", "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "sami/sami": "~2.0", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { @@ -641,7 +640,7 @@ "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." }, - "time": "2020-07-08T09:08:33+00:00", + "time": "2020-09-08T04:24:43+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/README.md b/apps/files_external/3rdparty/phpseclib/phpseclib/README.md index 56260b0bcc36..a2e079c4cb72 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/README.md +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/README.md @@ -19,7 +19,7 @@ AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509 ## Documentation * [Documentation / Manual](http://phpseclib.sourceforge.net/) -* [API Documentation](https://api.phpseclib.org/2.0/) (generated by Sami) +* [API Documentation](https://api.phpseclib.org/2.0/) (generated by Doctum) ## Branches diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/composer.json b/apps/files_external/3rdparty/phpseclib/phpseclib/composer.json index b4e8a1c9c921..9303f8aa998b 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/composer.json +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/composer.json @@ -56,7 +56,6 @@ "require-dev": { "phing/phing": "~2.7", "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "sami/sami": "~2.0", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php index 72be6eeb19b7..3ece5170530f 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Crypt/RSA.php @@ -1539,6 +1539,8 @@ function. As is, the definitive authority on this encoding scheme isn't the IET return $components; } + + return false; } /** diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/File/X509.php b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/File/X509.php index ddbc61595776..9612b82553ac 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/File/X509.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/File/X509.php @@ -5054,7 +5054,9 @@ function _extractBER($str) * subject=/O=organization/OU=org unit/CN=common name * issuer=/O=organization/CN=common name */ - $temp = preg_replace('#.*?^-+[^-]+-+[\r\n ]*$#ms', '', $str, 1); + $temp = strlen($str) <= ini_get('pcre.backtrack_limit') ? + preg_replace('#.*?^-+[^-]+-+[\r\n ]*$#ms', '', $str, 1) : + $str; // remove the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- stuff $temp = preg_replace('#-+[^-]+-+#', '', $temp); // remove new lines diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SFTP.php index 7c821377b680..2826a607f836 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SFTP.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SFTP.php @@ -259,6 +259,16 @@ class SFTP extends SSH2 */ var $requestBuffer = array(); + /** + * Preserve timestamps on file downloads / uploads + * + * @see self::get() + * @see self::put() + * @var bool + * @access private + */ + var $preserveTime = false; + /** * Default Constructor. * @@ -2075,7 +2085,14 @@ function put($remote_file, $data, $mode = self::SOURCE_STRING, $start = -1, $loc } if ($mode & self::SOURCE_LOCAL_FILE) { - fclose($fp); + if ($this->preserveTime) { + $stat = fstat($fp); + $this->touch($remote_file, $stat['mtime'], $stat['atime']); + } + + if (isset($fp) && is_resource($fp)) { + fclose($fp); + } } return $this->_close_handle($handle); @@ -2292,6 +2309,11 @@ function get($remote_file, $local_file = false, $offset = 0, $length = -1, $prog if ($fclose_check) { fclose($fp); + + if ($this->preserveTime) { + $stat = $this->stat($remote_file); + touch($local_file, $stat['mtime'], $stat['atime']); + } } if (!$this->_close_handle($handle)) { @@ -2960,6 +2982,10 @@ function _parseLongname($longname) */ function _send_sftp_packet($type, $data, $request_id = 1) { + // in SSH2.php the timeout is cumulative per function call. eg. exec() will + // timeout after 10s. but for SFTP.php it's cumulative per packet + $this->curTimeout = $this->timeout; + $packet = $this->use_request_id ? pack('NCNa*', strlen($data) + 5, $type, $request_id, $data) : pack('NCa*', strlen($data) + 1, $type, $data); @@ -3176,4 +3202,24 @@ function _disconnect($reason) $this->pwd = false; parent::_disconnect($reason); } + + /** + * Enable Date Preservation + * + * @access public + */ + function enableDatePreservation() + { + $this->preserveTime = true; + } + + /** + * Disable Date Preservation + * + * @access public + */ + function disableDatePreservation() + { + $this->preserveTime = false; + } } diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php index ba83c9d0e270..f125185bb05e 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php @@ -2125,11 +2125,13 @@ function login($username) // try logging with 'none' as an authentication method first since that's what // PuTTY does - if ($this->_login($username)) { - return true; - } - if (count($args) == 1) { - return false; + if (substr($this->server_identifier, 0, 13) != 'SSH-2.0-CoreFTP') { + if ($this->_login($username)) { + return true; + } + if (count($args) == 1) { + return false; + } } return call_user_func_array(array(&$this, '_login'), $args); } @@ -3962,7 +3964,7 @@ function _send_binary_packet($data, $logged = null) $packet.= $hmac; $start = microtime(true); - $result = strlen($packet) == fputs($this->fsock, $packet); + $result = strlen($packet) == @fputs($this->fsock, $packet); $stop = microtime(true); if (defined('NET_SSH2_LOGGING')) { @@ -4603,11 +4605,15 @@ function getSupportedEncryptionAlgorithms() //'none' // OPTIONAL no encryption; NOT RECOMMENDED ); - $engines = array( - Base::ENGINE_OPENSSL, - Base::ENGINE_MCRYPT, - Base::ENGINE_INTERNAL - ); + if ($this->crypto_engine) { + $engines = array($this->crypto_engine); + } else { + $engines = array( + Base::ENGINE_OPENSSL, + Base::ENGINE_MCRYPT, + Base::ENGINE_INTERNAL + ); + } $ciphers = array(); foreach ($engines as $engine) {