Resolved gh-444 by adding the new phpspreadsheet library, and removing the old PHPExcel library.
This commit is contained in:
69
libraries/phpseclib/vendor/composer/LICENSE
vendored
69
libraries/phpseclib/vendor/composer/LICENSE
vendored
@ -1,21 +1,56 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: Composer
|
||||
Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be>
|
||||
Source: https://github.com/composer/composer
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
Files: *
|
||||
Copyright: 2016, Nils Adermann <naderman@naderman.de>
|
||||
2016, Jordi Boggiano <j.boggiano@seld.be>
|
||||
License: Expat
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
Files: src/Composer/Util/TlsHelper.php
|
||||
Copyright: 2016, Nils Adermann <naderman@naderman.de>
|
||||
2016, Jordi Boggiano <j.boggiano@seld.be>
|
||||
2013, Evan Coury <me@evancoury.com>
|
||||
License: Expat and BSD-2-Clause
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
License: BSD-2-Clause
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
.
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
License: Expat
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
@ -6,4 +6,28 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'phpseclib\\Crypt\\AES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php',
|
||||
'phpseclib\\Crypt\\Base' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php',
|
||||
'phpseclib\\Crypt\\Blowfish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php',
|
||||
'phpseclib\\Crypt\\DES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php',
|
||||
'phpseclib\\Crypt\\Hash' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php',
|
||||
'phpseclib\\Crypt\\RC2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php',
|
||||
'phpseclib\\Crypt\\RC4' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php',
|
||||
'phpseclib\\Crypt\\RSA' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php',
|
||||
'phpseclib\\Crypt\\Random' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
|
||||
'phpseclib\\Crypt\\Rijndael' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php',
|
||||
'phpseclib\\Crypt\\TripleDES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php',
|
||||
'phpseclib\\Crypt\\Twofish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php',
|
||||
'phpseclib\\File\\ANSI' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ANSI.php',
|
||||
'phpseclib\\File\\ASN1' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ASN1.php',
|
||||
'phpseclib\\File\\ASN1\\Element' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php',
|
||||
'phpseclib\\File\\X509' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/X509.php',
|
||||
'phpseclib\\Math\\BigInteger' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php',
|
||||
'phpseclib\\Net\\SCP' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SCP.php',
|
||||
'phpseclib\\Net\\SFTP' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php',
|
||||
'phpseclib\\Net\\SFTP\\Stream' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php',
|
||||
'phpseclib\\Net\\SSH1' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SSH1.php',
|
||||
'phpseclib\\Net\\SSH2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php',
|
||||
'phpseclib\\System\\SSH\\Agent' => $vendorDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php',
|
||||
'phpseclib\\System\\SSH\\Agent\\Identity' => $vendorDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php',
|
||||
);
|
||||
|
@ -24,11 +24,39 @@ class ComposerStaticInit10d22a526bd476954b93748a871e7ad4
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'phpseclib\\Crypt\\AES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php',
|
||||
'phpseclib\\Crypt\\Base' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php',
|
||||
'phpseclib\\Crypt\\Blowfish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php',
|
||||
'phpseclib\\Crypt\\DES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php',
|
||||
'phpseclib\\Crypt\\Hash' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php',
|
||||
'phpseclib\\Crypt\\RC2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php',
|
||||
'phpseclib\\Crypt\\RC4' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php',
|
||||
'phpseclib\\Crypt\\RSA' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php',
|
||||
'phpseclib\\Crypt\\Random' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
|
||||
'phpseclib\\Crypt\\Rijndael' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php',
|
||||
'phpseclib\\Crypt\\TripleDES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php',
|
||||
'phpseclib\\Crypt\\Twofish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php',
|
||||
'phpseclib\\File\\ANSI' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ANSI.php',
|
||||
'phpseclib\\File\\ASN1' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ASN1.php',
|
||||
'phpseclib\\File\\ASN1\\Element' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php',
|
||||
'phpseclib\\File\\X509' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/X509.php',
|
||||
'phpseclib\\Math\\BigInteger' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php',
|
||||
'phpseclib\\Net\\SCP' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SCP.php',
|
||||
'phpseclib\\Net\\SFTP' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php',
|
||||
'phpseclib\\Net\\SFTP\\Stream' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php',
|
||||
'phpseclib\\Net\\SSH1' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SSH1.php',
|
||||
'phpseclib\\Net\\SSH2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php',
|
||||
'phpseclib\\System\\SSH\\Agent' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php',
|
||||
'phpseclib\\System\\SSH\\Agent\\Identity' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit10d22a526bd476954b93748a871e7ad4::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit10d22a526bd476954b93748a871e7ad4::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit10d22a526bd476954b93748a871e7ad4::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
[
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "2.0.23",
|
||||
"version_normalized": "2.0.23.0",
|
||||
"version": "2.0.27",
|
||||
"version_normalized": "2.0.27.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "c78eb5058d5bb1a183133c36d4ba5b6675dfa099"
|
||||
"reference": "34620af4df7d1988d8f0d7e91f6c8a3bf931d8dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c78eb5058d5bb1a183133c36d4ba5b6675dfa099",
|
||||
"reference": "c78eb5058d5bb1a183133c36d4ba5b6675dfa099",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/34620af4df7d1988d8f0d7e91f6c8a3bf931d8dc",
|
||||
"reference": "34620af4df7d1988d8f0d7e91f6c8a3bf931d8dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -29,7 +29,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": "2019-09-17T03:41:22+00:00",
|
||||
"time": "2020-04-04T23:17:33+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -4,4 +4,5 @@ phpseclib ongoing development is made possible by [Tidelift](https://tidelift.co
|
||||
|
||||
## Backers
|
||||
|
||||
- Zane Hooper
|
||||
- Zane Hooper
|
||||
- [Setasign](https://www.setasign.com/)
|
@ -15,7 +15,6 @@ arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4, Rijndael,
|
||||
AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509
|
||||
|
||||
* [Browse Git](https://github.com/phpseclib/phpseclib)
|
||||
* [Code Coverage Report](https://coverage.phpseclib.org/2.0/latest/)
|
||||
|
||||
## Documentation
|
||||
|
||||
@ -45,7 +44,7 @@ AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509
|
||||
* Composer compatible (PSR-0 autoloading)
|
||||
* Install using Composer: `composer require phpseclib/phpseclib:~1.0`
|
||||
* Install using PEAR: See [phpseclib PEAR Channel Documentation](http://phpseclib.sourceforge.net/pear.htm)
|
||||
* [Download 1.0.17 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.17.zip/download)
|
||||
* [Download 1.0.18 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.18.zip/download)
|
||||
|
||||
## Security contact information
|
||||
|
||||
|
@ -2762,7 +2762,7 @@ class RSA
|
||||
// if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error
|
||||
// be output.
|
||||
|
||||
$emLen = ($emBits + 1) >> 3; // ie. ceil($emBits / 8);
|
||||
$emLen = ($emBits + 7) >> 3; // ie. ceil($emBits / 8);
|
||||
$sLen = $this->sLen !== null ? $this->sLen : $this->hLen;
|
||||
|
||||
$mHash = $this->hash->hash($m);
|
||||
@ -2840,7 +2840,7 @@ class RSA
|
||||
|
||||
// RSA verification
|
||||
|
||||
$modBits = 8 * $this->k;
|
||||
$modBits = strlen($this->modulus->toBits());
|
||||
|
||||
$s2 = $this->_os2ip($s);
|
||||
$m2 = $this->_rsavp1($s2);
|
||||
@ -2848,7 +2848,7 @@ class RSA
|
||||
user_error('Invalid signature');
|
||||
return false;
|
||||
}
|
||||
$em = $this->_i2osp($m2, $modBits >> 3);
|
||||
$em = $this->_i2osp($m2, $this->k);
|
||||
if ($em === false) {
|
||||
user_error('Invalid signature');
|
||||
return false;
|
||||
|
@ -97,7 +97,10 @@ class Random
|
||||
$fp = @fopen('/dev/urandom', 'rb');
|
||||
}
|
||||
if ($fp !== true && $fp !== false) { // surprisingly faster than !is_bool() or is_resource()
|
||||
return fread($fp, $length);
|
||||
$temp = fread($fp, $length);
|
||||
if (strlen($temp) == $length) {
|
||||
return $temp;
|
||||
}
|
||||
}
|
||||
// method 3. pretty much does the same thing as method 2 per the following url:
|
||||
// https://github.com/php/php-src/blob/7014a0eb6d1611151a286c0ff4f2238f92c120d6/ext/mcrypt/mcrypt.c#L1391
|
||||
|
@ -493,6 +493,10 @@ class ASN1
|
||||
*/
|
||||
function asn1map($decoded, $mapping, $special = array())
|
||||
{
|
||||
if (!is_array($decoded)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($mapping['explicit']) && is_array($decoded['content'])) {
|
||||
$decoded = $decoded['content'][0];
|
||||
}
|
||||
|
@ -2179,7 +2179,11 @@ class X509
|
||||
}
|
||||
|
||||
while (!feof($fsock)) {
|
||||
$data.= fread($fsock, 1024);
|
||||
$temp = fread($fsock, 1024);
|
||||
if ($temp === false) {
|
||||
return false;
|
||||
}
|
||||
$data.= $temp;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -397,6 +397,9 @@ class SFTP extends SSH2
|
||||
if (!defined('NET_SFTP_QUEUE_SIZE')) {
|
||||
define('NET_SFTP_QUEUE_SIZE', 32);
|
||||
}
|
||||
if (!defined('NET_SFTP_UPLOAD_QUEUE_SIZE')) {
|
||||
define('NET_SFTP_UPLOAD_QUEUE_SIZE', 1024);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,9 +412,7 @@ class SFTP extends SSH2
|
||||
*/
|
||||
function login($username)
|
||||
{
|
||||
$args = func_get_args();
|
||||
$this->auth[] = $args;
|
||||
if (!call_user_func_array(array(&$this, '_login'), $args)) {
|
||||
if (!call_user_func_array('parent::login', func_get_args())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1775,9 +1776,6 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
$dir = $this->_realpath($dir);
|
||||
// by not providing any permissions, hopefully the server will use the logged in users umask - their
|
||||
// default permissions.
|
||||
$attr = $mode == -1 ? "\0\0\0\0" : pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777);
|
||||
|
||||
if ($recursive) {
|
||||
$dirs = explode('/', preg_replace('#/(?=/)|/$#', '', $dir));
|
||||
@ -1788,12 +1786,12 @@ class SFTP extends SSH2
|
||||
for ($i = 0; $i < count($dirs); $i++) {
|
||||
$temp = array_slice($dirs, 0, $i + 1);
|
||||
$temp = implode('/', $temp);
|
||||
$result = $this->_mkdir_helper($temp, $attr);
|
||||
$result = $this->_mkdir_helper($temp, $mode);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $this->_mkdir_helper($dir, $attr);
|
||||
return $this->_mkdir_helper($dir, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1803,9 +1801,10 @@ class SFTP extends SSH2
|
||||
* @return bool
|
||||
* @access private
|
||||
*/
|
||||
function _mkdir_helper($dir, $attr)
|
||||
function _mkdir_helper($dir, $mode)
|
||||
{
|
||||
if (!$this->_send_sftp_packet(NET_SFTP_MKDIR, pack('Na*a*', strlen($dir), $dir, $attr))) {
|
||||
// send SSH_FXP_MKDIR without any attributes (that's what the \0\0\0\0 is doing)
|
||||
if (!$this->_send_sftp_packet(NET_SFTP_MKDIR, pack('Na*a*', strlen($dir), $dir, "\0\0\0\0"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1824,6 +1823,10 @@ class SFTP extends SSH2
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($mode !== -1) {
|
||||
$this->chmod($mode, $dir);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2018,7 +2021,7 @@ class SFTP extends SSH2
|
||||
$sftp_packet_size = 4096; // PuTTY uses 4096
|
||||
// make the SFTP packet be exactly 4096 bytes by including the bytes in the NET_SFTP_WRITE packets "header"
|
||||
$sftp_packet_size-= strlen($handle) + 25;
|
||||
$i = 0;
|
||||
$i = $j = 0;
|
||||
while ($dataCallback || ($size === 0 || $sent < $size)) {
|
||||
if ($dataCallback) {
|
||||
$temp = call_user_func($dataCallback, $sftp_packet_size);
|
||||
@ -2034,7 +2037,7 @@ class SFTP extends SSH2
|
||||
|
||||
$subtemp = $offset + $sent;
|
||||
$packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp);
|
||||
if (!$this->_send_sftp_packet(NET_SFTP_WRITE, $packet)) {
|
||||
if (!$this->_send_sftp_packet(NET_SFTP_WRITE, $packet, $j)) {
|
||||
if ($mode & self::SOURCE_LOCAL_FILE) {
|
||||
fclose($fp);
|
||||
}
|
||||
@ -2046,8 +2049,9 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
$i++;
|
||||
$j++;
|
||||
|
||||
if ($i == NET_SFTP_QUEUE_SIZE) {
|
||||
if ($i == NET_SFTP_UPLOAD_QUEUE_SIZE) {
|
||||
if (!$this->_read_put_responses($i)) {
|
||||
$i = 0;
|
||||
break;
|
||||
|
@ -1124,6 +1124,9 @@ class SSH1
|
||||
|
||||
while ($length > 0) {
|
||||
$temp = fread($this->fsock, $length);
|
||||
if (strlen($temp) != $length) {
|
||||
return false;
|
||||
}
|
||||
$raw.= $temp;
|
||||
$length-= strlen($temp);
|
||||
}
|
||||
|
@ -592,6 +592,20 @@ class SSH2
|
||||
*/
|
||||
var $window_size = 0x7FFFFFFF;
|
||||
|
||||
/**
|
||||
* What we resize the window to
|
||||
*
|
||||
* When PuTTY resizes the window it doesn't add an additional 0x7FFFFFFF bytes - it adds 0x40000000 bytes.
|
||||
* Some SFTP clients (GoAnywhere) don't support adding 0x7FFFFFFF to the window size after the fact so
|
||||
* we'll just do what PuTTY does
|
||||
*
|
||||
* @var int
|
||||
* @see self::_send_channel_packet()
|
||||
* @see self::exec()
|
||||
* @access private
|
||||
*/
|
||||
var $window_resize = 0x40000000;
|
||||
|
||||
/**
|
||||
* Window size, server to client
|
||||
*
|
||||
@ -1204,6 +1218,9 @@ class SSH2
|
||||
if (strlen($temp) == 255) {
|
||||
continue;
|
||||
}
|
||||
if ($temp === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$line.= "$temp\n";
|
||||
|
||||
@ -1527,8 +1544,8 @@ class SSH2
|
||||
if ($kex_algorithm === 'curve25519-sha256@libssh.org') {
|
||||
$x = Random::string(32);
|
||||
$eBytes = sodium_crypto_box_publickey_from_secretkey($x);
|
||||
$clientKexInitMessage = NET_SSH2_MSG_KEX_ECDH_INIT;
|
||||
$serverKexReplyMessage = NET_SSH2_MSG_KEX_ECDH_REPLY;
|
||||
$clientKexInitMessage = 'NET_SSH2_MSG_KEX_ECDH_INIT';
|
||||
$serverKexReplyMessage = 'NET_SSH2_MSG_KEX_ECDH_REPLY';
|
||||
$kexHash = new Hash('sha256');
|
||||
} else {
|
||||
if (strpos($kex_algorithm, 'diffie-hellman-group-exchange') === 0) {
|
||||
@ -1546,6 +1563,7 @@ class SSH2
|
||||
if (!$this->_send_binary_packet($packet)) {
|
||||
return false;
|
||||
}
|
||||
$this->_updateLogHistory('UNKNOWN (34)', 'NET_SSH2_MSG_KEXDH_GEX_REQUEST');
|
||||
|
||||
$response = $this->_get_binary_packet();
|
||||
if ($response === false) {
|
||||
@ -1558,6 +1576,7 @@ class SSH2
|
||||
user_error('Expected SSH_MSG_KEX_DH_GEX_GROUP');
|
||||
return false;
|
||||
}
|
||||
$this->_updateLogHistory('NET_SSH2_MSG_KEXDH_REPLY', 'NET_SSH2_MSG_KEXDH_GEX_GROUP');
|
||||
|
||||
if (strlen($response) < 4) {
|
||||
return false;
|
||||
@ -1582,8 +1601,8 @@ class SSH2
|
||||
$gBytes
|
||||
);
|
||||
|
||||
$clientKexInitMessage = NET_SSH2_MSG_KEXDH_GEX_INIT;
|
||||
$serverKexReplyMessage = NET_SSH2_MSG_KEXDH_GEX_REPLY;
|
||||
$clientKexInitMessage = 'NET_SSH2_MSG_KEXDH_GEX_INIT';
|
||||
$serverKexReplyMessage = 'NET_SSH2_MSG_KEXDH_GEX_REPLY';
|
||||
} else {
|
||||
switch ($kex_algorithm) {
|
||||
// see http://tools.ietf.org/html/rfc2409#section-6.2 and
|
||||
@ -1610,8 +1629,8 @@ class SSH2
|
||||
// the generator field element is 2 (decimal) and the hash function is sha1.
|
||||
$g = new BigInteger(2);
|
||||
$prime = new BigInteger($prime, 16);
|
||||
$clientKexInitMessage = NET_SSH2_MSG_KEXDH_INIT;
|
||||
$serverKexReplyMessage = NET_SSH2_MSG_KEXDH_REPLY;
|
||||
$clientKexInitMessage = 'NET_SSH2_MSG_KEXDH_INIT';
|
||||
$serverKexReplyMessage = 'NET_SSH2_MSG_KEXDH_REPLY';
|
||||
}
|
||||
|
||||
switch ($kex_algorithm) {
|
||||
@ -1639,13 +1658,20 @@ class SSH2
|
||||
|
||||
$eBytes = $e->toBytes(true);
|
||||
}
|
||||
$data = pack('CNa*', $clientKexInitMessage, strlen($eBytes), $eBytes);
|
||||
$data = pack('CNa*', constant($clientKexInitMessage), strlen($eBytes), $eBytes);
|
||||
|
||||
if (!$this->_send_binary_packet($data)) {
|
||||
$this->bitmap = 0;
|
||||
user_error('Connection closed by server');
|
||||
return false;
|
||||
}
|
||||
switch ($clientKexInitMessage) {
|
||||
case 'NET_SSH2_MSG_KEX_ECDH_INIT':
|
||||
$this->_updateLogHistory('NET_SSH2_MSG_KEXDH_INIT', 'NET_SSH2_MSG_KEX_ECDH_INIT');
|
||||
break;
|
||||
case 'NET_SSH2_MSG_KEXDH_GEX_INIT':
|
||||
$this->_updateLogHistory('UNKNOWN (32)', 'NET_SSH2_MSG_KEXDH_GEX_INIT');
|
||||
}
|
||||
|
||||
$response = $this->_get_binary_packet();
|
||||
if ($response === false) {
|
||||
@ -1658,10 +1684,17 @@ class SSH2
|
||||
}
|
||||
extract(unpack('Ctype', $this->_string_shift($response, 1)));
|
||||
|
||||
if ($type != $serverKexReplyMessage) {
|
||||
user_error('Expected SSH_MSG_KEXDH_REPLY');
|
||||
if ($type != constant($serverKexReplyMessage)) {
|
||||
user_error("Expected $serverKexReplyMessage");
|
||||
return false;
|
||||
}
|
||||
switch ($serverKexReplyMessage) {
|
||||
case 'NET_SSH2_MSG_KEX_ECDH_REPLY':
|
||||
$this->_updateLogHistory('NET_SSH2_MSG_KEXDH_REPLY', 'NET_SSH2_MSG_KEX_ECDH_REPLY');
|
||||
break;
|
||||
case 'NET_SSH2_MSG_KEXDH_GEX_REPLY':
|
||||
$this->_updateLogHistory('UNKNOWN (33)', 'NET_SSH2_MSG_KEXDH_GEX_REPLY');
|
||||
}
|
||||
|
||||
if (strlen($response) < 4) {
|
||||
return false;
|
||||
@ -1699,7 +1732,14 @@ class SSH2
|
||||
return false;
|
||||
}
|
||||
$key = new BigInteger(sodium_crypto_scalarmult($x, $fBytes), 256);
|
||||
sodium_memzero($x);
|
||||
// sodium_compat doesn't emulate sodium_memzero
|
||||
// also, with v1 of libsodium API the extension identifies itself as
|
||||
// libsodium whereas v2 of the libsodium API (what PHP 7.2+ includes)
|
||||
// identifies itself as sodium. sodium_compat uses the v1 API to
|
||||
// emulate the v2 API if it's the v1 API that's available
|
||||
if (extension_loaded('sodium') || extension_loaded('libsodium')) {
|
||||
sodium_memzero($x);
|
||||
}
|
||||
} else {
|
||||
$f = new BigInteger($fBytes, -256);
|
||||
$key = $f->modPow($x, $prime);
|
||||
@ -2082,6 +2122,15 @@ class SSH2
|
||||
{
|
||||
$args = func_get_args();
|
||||
$this->auth[] = $args;
|
||||
|
||||
// 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;
|
||||
}
|
||||
return call_user_func_array(array(&$this, '_login'), $args);
|
||||
}
|
||||
|
||||
@ -2277,9 +2326,7 @@ class SSH2
|
||||
|
||||
switch ($type) {
|
||||
case NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: // in theory, the password can be changed
|
||||
if (defined('NET_SSH2_LOGGING')) {
|
||||
$this->message_number_log[count($this->message_number_log) - 1] = 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ';
|
||||
}
|
||||
$this->_updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ');
|
||||
if (strlen($response) < 4) {
|
||||
return false;
|
||||
}
|
||||
@ -2430,12 +2477,8 @@ class SSH2
|
||||
// see http://tools.ietf.org/html/rfc4256#section-3.2
|
||||
if (strlen($this->last_interactive_response)) {
|
||||
$this->last_interactive_response = '';
|
||||
} elseif (defined('NET_SSH2_LOGGING')) {
|
||||
$this->message_number_log[count($this->message_number_log) - 1] = str_replace(
|
||||
'UNKNOWN',
|
||||
'NET_SSH2_MSG_USERAUTH_INFO_REQUEST',
|
||||
$this->message_number_log[count($this->message_number_log) - 1]
|
||||
);
|
||||
} else {
|
||||
$this->_updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST');
|
||||
}
|
||||
|
||||
if (!count($responses) && $num_prompts) {
|
||||
@ -2458,13 +2501,7 @@ class SSH2
|
||||
return false;
|
||||
}
|
||||
|
||||
if (defined('NET_SSH2_LOGGING') && NET_SSH2_LOGGING == self::LOG_COMPLEX) {
|
||||
$this->message_number_log[count($this->message_number_log) - 1] = str_replace(
|
||||
'UNKNOWN',
|
||||
'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE',
|
||||
$this->message_number_log[count($this->message_number_log) - 1]
|
||||
);
|
||||
}
|
||||
$this->_updateLogHistory('UNKNOWN (61)', 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE');
|
||||
|
||||
/*
|
||||
After receiving the response, the server MUST send either an
|
||||
@ -2591,13 +2628,7 @@ class SSH2
|
||||
case NET_SSH2_MSG_USERAUTH_PK_OK:
|
||||
// we'll just take it on faith that the public key blob and the public key algorithm name are as
|
||||
// they should be
|
||||
if (defined('NET_SSH2_LOGGING') && NET_SSH2_LOGGING == self::LOG_COMPLEX) {
|
||||
$this->message_number_log[count($this->message_number_log) - 1] = str_replace(
|
||||
'UNKNOWN',
|
||||
'NET_SSH2_MSG_USERAUTH_PK_OK',
|
||||
$this->message_number_log[count($this->message_number_log) - 1]
|
||||
);
|
||||
}
|
||||
$this->_updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_PK_OK');
|
||||
}
|
||||
|
||||
$packet = $part1 . chr(1) . $part2;
|
||||
@ -3695,11 +3726,13 @@ class SSH2
|
||||
|
||||
// resize the window, if appropriate
|
||||
if ($this->window_size_server_to_client[$channel] < 0) {
|
||||
$packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$channel], $this->window_size);
|
||||
// PuTTY does something more analogous to the following:
|
||||
//if ($this->window_size_server_to_client[$channel] < 0x3FFFFFFF) {
|
||||
$packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$channel], $this->window_resize);
|
||||
if (!$this->_send_binary_packet($packet)) {
|
||||
return false;
|
||||
}
|
||||
$this->window_size_server_to_client[$channel]+= $this->window_size;
|
||||
$this->window_size_server_to_client[$channel]+= $this->window_resize;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
@ -4450,7 +4483,7 @@ class SSH2
|
||||
* @return array
|
||||
* @access public
|
||||
*/
|
||||
public function getServerAlgorithms()
|
||||
function getServerAlgorithms()
|
||||
{
|
||||
$this->_connect();
|
||||
|
||||
@ -4582,10 +4615,7 @@ class SSH2
|
||||
switch ($algo) {
|
||||
case 'arcfour128':
|
||||
case 'arcfour256':
|
||||
if ($engine == Base::ENGINE_INTERNAL) {
|
||||
$algos = array_diff($algos, array($algo));
|
||||
$ciphers[] = $algo;
|
||||
} else {
|
||||
if ($engine != Base::ENGINE_INTERNAL) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
@ -5040,4 +5070,22 @@ class SSH2
|
||||
$this->windowColumns = $columns;
|
||||
$this->windowRows = $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update packet types in log history
|
||||
*
|
||||
* @param string $old
|
||||
* @param string $new
|
||||
* @access private
|
||||
*/
|
||||
function _updateLogHistory($old, $new)
|
||||
{
|
||||
if (defined('NET_SSH2_LOGGING') && NET_SSH2_LOGGING == self::LOG_COMPLEX) {
|
||||
$this->message_number_log[count($this->message_number_log) - 1] = str_replace(
|
||||
$old,
|
||||
$new,
|
||||
$this->message_number_log[count($this->message_number_log) - 1]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,12 @@ class Agent
|
||||
return array();
|
||||
}
|
||||
|
||||
$length = current(unpack('N', fread($this->fsock, 4)));
|
||||
$temp = fread($this->fsock, 4);
|
||||
if (strlen($temp) != 4) {
|
||||
user_error('Connection closed while requesting identities');
|
||||
return array();
|
||||
}
|
||||
$length = current(unpack('N', $temp));
|
||||
$type = ord(fread($this->fsock, 1));
|
||||
if ($type != self::SSH_AGENT_IDENTITIES_ANSWER) {
|
||||
user_error('Unable to request identities');
|
||||
@ -168,14 +173,38 @@ class Agent
|
||||
}
|
||||
|
||||
$identities = array();
|
||||
$keyCount = current(unpack('N', fread($this->fsock, 4)));
|
||||
$temp = fread($this->fsock, 4);
|
||||
if (strlen($temp) != 4) {
|
||||
user_error('Connection closed while requesting identities');
|
||||
return array();
|
||||
}
|
||||
$keyCount = current(unpack('N', $temp));
|
||||
for ($i = 0; $i < $keyCount; $i++) {
|
||||
$length = current(unpack('N', fread($this->fsock, 4)));
|
||||
$temp = fread($this->fsock, 4);
|
||||
if (strlen($temp) != 4) {
|
||||
user_error('Connection closed while requesting identities');
|
||||
return array();
|
||||
}
|
||||
$length = current(unpack('N', $temp));
|
||||
$key_blob = fread($this->fsock, $length);
|
||||
if (strlen($key_blob) != $length) {
|
||||
user_error('Connection closed while requesting identities');
|
||||
return array();
|
||||
}
|
||||
$key_str = 'ssh-rsa ' . base64_encode($key_blob);
|
||||
$length = current(unpack('N', fread($this->fsock, 4)));
|
||||
$temp = fread($this->fsock, 4);
|
||||
if (strlen($temp) != 4) {
|
||||
user_error('Connection closed while requesting identities');
|
||||
return array();
|
||||
}
|
||||
$length = current(unpack('N', $temp));
|
||||
if ($length) {
|
||||
$key_str.= ' ' . fread($this->fsock, $length);
|
||||
$temp = fread($this->fsock, $length);
|
||||
if (strlen($temp) != $length) {
|
||||
user_error('Connection closed while requesting identities');
|
||||
return array();
|
||||
}
|
||||
$key_str.= ' ' . $temp;
|
||||
}
|
||||
$length = current(unpack('N', substr($key_blob, 0, 4)));
|
||||
$key_type = substr($key_blob, 4, $length);
|
||||
@ -297,14 +326,24 @@ class Agent
|
||||
|
||||
if (strlen($this->socket_buffer) != fwrite($this->fsock, $this->socket_buffer)) {
|
||||
user_error('Connection closed attempting to forward data to SSH agent');
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->socket_buffer = '';
|
||||
$this->expected_bytes = 0;
|
||||
|
||||
$agent_reply_bytes = current(unpack('N', fread($this->fsock, 4)));
|
||||
$temp = fread($this->fsock, 4);
|
||||
if (strlen($temp) != 4) {
|
||||
user_error('Connection closed while reading data response');
|
||||
return false;
|
||||
}
|
||||
$agent_reply_bytes = current(unpack('N', $temp));
|
||||
|
||||
$agent_reply_data = fread($this->fsock, $agent_reply_bytes);
|
||||
if (strlen($agent_reply_data) != $agent_reply_bytes) {
|
||||
user_error('Connection closed while reading data response');
|
||||
return false;
|
||||
}
|
||||
$agent_reply_data = current(unpack('a*', $agent_reply_data));
|
||||
|
||||
return pack('Na*', $agent_reply_bytes, $agent_reply_data);
|
||||
|
@ -188,15 +188,26 @@ class Identity
|
||||
$packet = pack('Na*', strlen($packet), $packet);
|
||||
if (strlen($packet) != fputs($this->fsock, $packet)) {
|
||||
user_error('Connection closed during signing');
|
||||
return false;
|
||||
}
|
||||
|
||||
$length = current(unpack('N', fread($this->fsock, 4)));
|
||||
$temp = fread($this->fsock, 4);
|
||||
if (strlen($temp) != 4) {
|
||||
user_error('Connection closed during signing');
|
||||
return false;
|
||||
}
|
||||
$length = current(unpack('N', $temp));
|
||||
$type = ord(fread($this->fsock, 1));
|
||||
if ($type != Agent::SSH_AGENT_SIGN_RESPONSE) {
|
||||
user_error('Unable to retrieve signature');
|
||||
return false;
|
||||
}
|
||||
|
||||
$signature_blob = fread($this->fsock, $length - 1);
|
||||
if (strlen($signature_blob) != $length - 1) {
|
||||
user_error('Connection closed during signing');
|
||||
return false;
|
||||
}
|
||||
$length = current(unpack('N', $this->_string_shift($signature_blob, 4)));
|
||||
if ($length != strlen($signature_blob)) {
|
||||
user_error('Malformed signature blob');
|
||||
|
Reference in New Issue
Block a user