Skip to content

Commit

Permalink
Merge pull request #37893 from owncloud/bump-phpseclib-2.0.29
Browse files Browse the repository at this point in the history
Update phpseclib/phpseclib (2.0.28 => 2.0.29)
  • Loading branch information
phil-davis authored Sep 8, 2020
2 parents 1f55065 + 167d8a1 commit 90cea11
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 34 deletions.
11 changes: 5 additions & 6 deletions apps/files_external/3rdparty/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions apps/files_external/3rdparty/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/phpseclib/phpseclib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,8 @@ function. As is, the definitive authority on this encoding scheme isn't the IET

return $components;
}

return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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')) {
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions changelog/unreleased/37893
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Change: Update phpseclib/phpseclib (2.0.28 => 2.0.29)

https://github.com/owncloud/core/pull/37893
11 changes: 5 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 90cea11

Please sign in to comment.