/trunk/vendor/phpseclib/phpseclib/BACKERS.md |
---|
13,4 → 13,5 |
- [Rachel Fish](https://github.com/itsrachelfish) |
- Tharyrok |
- [cjhaas](https://github.com/cjhaas) |
- [istiak-tridip](https://github.com/istiak-tridip) |
- [istiak-tridip](https://github.com/istiak-tridip) |
- [Anna Filina](https://github.com/afilina) |
/trunk/vendor/phpseclib/phpseclib/README.md |
---|
51,7 → 51,7 |
* PHP4 compatible |
* Composer compatible (PSR-0 autoloading) |
* Install using Composer: `composer require phpseclib/phpseclib:~1.0` |
* [Download 1.0.22 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.22.zip/download) |
* [Download 1.0.23 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.23.zip/download) |
## Security contact information |
/trunk/vendor/phpseclib/phpseclib/phpseclib/File/ASN1.php |
---|
1148,6 → 1148,11 |
$oid = []; |
$pos = 0; |
$len = strlen($content); |
// see https://github.com/openjdk/jdk/blob/2deb318c9f047ec5a4b160d66a4b52f93688ec42/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java#L55 |
if ($len > 4096) { |
//throw new \RuntimeException("Object identifier size is limited to 4096 bytes ($len bytes present)"); |
return false; |
} |
if (ord($content[$len - 1]) & 0x80) { |
return false; |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php |
---|
619,7 → 619,7 |
*/ |
public function getLengthInBytes() |
{ |
return strlen($this->toBytes()); |
return (int) ceil($this->getLength() / 8); |
} |
/** |
786,6 → 786,11 |
$min = $temp; |
} |
$length = $max->getLength(); |
if ($length > 8196) { |
throw new \RuntimeException("Generation of random prime numbers larger than 8196 has been disabled ($length)"); |
} |
$x = static::randomRange($min, $max); |
return static::randomRangePrimeInner($x, $min, $max); |
990,6 → 995,15 |
*/ |
public function isPrime($t = false) |
{ |
// OpenSSL limits RSA keys to 16384 bits. The length of an RSA key is equal to the length of the modulo, which is |
// produced by multiplying the primes p and q by one another. The largest number two 8196 bit primes can produce is |
// a 16384 bit number so, basically, 8196 bit primes are the largest OpenSSL will generate and if that's the largest |
// that it'll generate it also stands to reason that that's the largest you'll be able to test primality on |
$length = $this->getLength(); |
if ($length > 8196) { |
throw new \RuntimeException("Primality testing is not supported for numbers larger than 8196 bits ($length)"); |
} |
if (!$t) { |
$t = $this->setupIsPrime(); |
} |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php |
---|
1341,4 → 1341,17 |
} |
return false; |
} |
/** |
* Return the size of a BigInteger in bits |
* |
* @return int |
*/ |
public function getLength() |
{ |
$max = count($this->value) - 1; |
return $max != -1 ? |
$max * static::BASE + intval(ceil(log($this->value[$max] + 1, 2))) : |
0; |
} |
} |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php |
---|
547,7 → 547,7 |
*/ |
private function partial_init_sftp_connection() |
{ |
$response = $this->openChannel(self::CHANNEL, true); |
$response = $this->open_channel(self::CHANNEL, true); |
if ($response === true && $this->isTimeout()) { |
return false; |
} |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php |
---|
2840,7 → 2840,7 |
// throw new \RuntimeException('If you want to run multiple exec()\'s you will need to disable (and re-enable if appropriate) a PTY for each one.'); |
//} |
$this->openChannel(self::CHANNEL_EXEC); |
$this->open_channel(self::CHANNEL_EXEC); |
if ($this->request_pty === true) { |
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END); |
2937,7 → 2937,7 |
* @param bool $skip_extended |
* @return bool |
*/ |
protected function openChannel($channel, $skip_extended = false) |
protected function open_channel($channel, $skip_extended = false) |
{ |
if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { |
throw new \RuntimeException('Please close the channel (' . $channel . ') before trying to open it again'); |
2994,7 → 2994,7 |
throw new InsufficientSetupException('Operation disallowed prior to login()'); |
} |
$this->openChannel(self::CHANNEL_SHELL); |
$this->open_channel(self::CHANNEL_SHELL); |
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END); |
$packet = Strings::packSSH2( |
3242,7 → 3242,7 |
*/ |
public function startSubsystem($subsystem) |
{ |
$this->openChannel(self::CHANNEL_SUBSYSTEM); |
$this->open_channel(self::CHANNEL_SUBSYSTEM); |
$packet = Strings::packSSH2( |
'CNsCs', |
3344,12 → 3344,39 |
/** |
* Is the connection still active? |
* |
* $level has 3x possible values: |
* 0 (default): phpseclib takes a passive approach to see if the connection is still active by calling feof() |
* on the socket |
* 1: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_IGNORE |
* packet that doesn't require a response |
* 2: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_CHANNEL_OPEN |
* packet and imediately trying to close that channel. some routers, in particular, however, will only let you |
* open one channel, so this approach could yield false positives |
* |
* @param int $level |
* @return bool |
*/ |
public function isConnected() |
public function isConnected($level = 0) |
{ |
if (!is_int($level) || $level < 0 || $level > 2) { |
throw new \InvalidArgumentException('$level must be 0, 1 or 2'); |
} |
if ($level == 0) { |
return ($this->bitmap & self::MASK_CONNECTED) && is_resource($this->fsock) && !feof($this->fsock); |
} |
try { |
if ($level == 1) { |
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); |
} else { |
$this->open_channel(self::CHANNEL_KEEP_ALIVE); |
$this->close_channel(self::CHANNEL_KEEP_ALIVE); |
} |
return true; |
} catch (\Exception $e) { |
return false; |
} |
} |
/** |
* Have you successfully been logged in? |
3421,7 → 3448,7 |
} |
try { |
$this->openChannel(self::CHANNEL_KEEP_ALIVE); |
$this->open_channel(self::CHANNEL_KEEP_ALIVE); |
} catch (\RuntimeException $e) { |
return $this->reconnect(); |
} |
3534,9 → 3561,11 |
} |
$start = microtime(true); |
if ($this->curTimeout) { |
$sec = (int) floor($this->curTimeout); |
$usec = (int) (1000000 * ($this->curTimeout - $sec)); |
stream_set_timeout($this->fsock, $sec, $usec); |
} |
$raw = stream_get_contents($this->fsock, $this->decrypt_block_size); |
if (!strlen($raw)) { |