mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-14 01:57:20 +01:00
Merge branch '3.0'
This commit is contained in:
commit
615dc51dec
@ -284,6 +284,21 @@ class SFTP extends SSH2
|
|||||||
*/
|
*/
|
||||||
private $preserveTime = false;
|
private $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?
|
||||||
*
|
*
|
||||||
@ -643,6 +658,26 @@ class SFTP extends SSH2
|
|||||||
$this->canonicalize_paths = false;
|
$this->canonicalize_paths = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable arbitrary length packets
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function enableArbitraryLengthPackets()
|
||||||
|
{
|
||||||
|
$this->allow_arbitrary_length_packets = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable arbitrary length packets
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function disableArbitraryLengthPackets()
|
||||||
|
{
|
||||||
|
$this->allow_arbitrary_length_packets = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current directory name
|
* Returns the current directory name
|
||||||
*
|
*
|
||||||
@ -2964,7 +2999,7 @@ class SFTP extends SSH2
|
|||||||
$tempLength-= strlen($this->packet_buffer);
|
$tempLength-= strlen($this->packet_buffer);
|
||||||
|
|
||||||
// 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) {
|
||||||
throw new \RuntimeException('Invalid Size');
|
throw new \RuntimeException('Invalid Size');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user