mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 11:52:48 +00:00
add option to allow arbitrary length packets, for servers like OpenText which sends extremely long directory listings
This commit is contained in:
parent
0ec9d2bdf1
commit
20500123e5
@ -310,6 +310,21 @@ class Net_SFTP extends Net_SSH2
|
|||||||
*/
|
*/
|
||||||
var $preserveTime = false;
|
var $preserveTime = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Arbitrary Length Packets Flag
|
||||||
|
*
|
||||||
|
* Determines whether or not packets of any length should be allowed,
|
||||||
|
* in cases where the server chooses the packet length (such as
|
||||||
|
* directory listings). By default, packets are only allowed to be
|
||||||
|
* 256 * 1024 bytes (SFTP_MAX_MSG_LENGTH from OpenSSH's sftp-common.h)
|
||||||
|
*
|
||||||
|
* @see self::enableArbitraryLengthPackets()
|
||||||
|
* @see self::_get_sftp_packet()
|
||||||
|
* @var bool
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $allow_arbitrary_length_packets = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Was the last packet due to the channels being closed or not?
|
* Was the last packet due to the channels being closed or not?
|
||||||
*
|
*
|
||||||
@ -703,6 +718,16 @@ class Net_SFTP extends Net_SSH2
|
|||||||
$this->canonicalize_paths = true;
|
$this->canonicalize_paths = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable arbitrary length packets
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function enableArbitraryLengthPackets()
|
||||||
|
{
|
||||||
|
$this->allow_arbitrary_length_packets = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable path canonicalization
|
* Enable path canonicalization
|
||||||
*
|
*
|
||||||
@ -3187,7 +3212,7 @@ class Net_SFTP extends Net_SSH2
|
|||||||
|
|
||||||
|
|
||||||
// 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h
|
// 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h
|
||||||
if (!$this->use_request_id && $tempLength > 256 * 1024) {
|
if (!$this->allow_arbitrary_length_packets &&!$this->use_request_id && $tempLength > 256 * 1024) {
|
||||||
user_error('Invalid SFTP packet size');
|
user_error('Invalid SFTP packet size');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user