Add PhpDoc @var for extract() functions

This commit is contained in:
Sokolovskyy Roman 2017-12-04 11:11:43 +01:00
parent 4bd11c6229
commit c705e7d9c6
16 changed files with 247 additions and 23 deletions

View File

@ -117,6 +117,7 @@ abstract class PuTTY
$source = Strings::packSSH2('ssss', static::TYPE, $encryption, $components['comment'], $public);
extract(unpack('Nlength', Strings::shift($public, 4)));
/** @var integer $length */
if (Strings::shift($public, $length) != static::TYPE) {
return false;
}

View File

@ -63,16 +63,14 @@ abstract class PuTTY extends Progenitor
if ($components === false || !isset($components['private'])) {
return $components;
}
extract($components);
unset($components['public'], $components['private']);
$result = Strings::unpackSSH2('iiii', $public);
$result = Strings::unpackSSH2('iiii', $components['public']);
if ($result === false) {
return false;
}
list($p, $q, $g, $y) = $result;
$result = Strings::unpackSSH2('i', $private);
$result = Strings::unpackSSH2('i', $components['private']);
if ($result === false) {
return false;
}

View File

@ -383,6 +383,9 @@ class RSA extends AsymmetricKey
$primes[$i] = BigInteger::randomPrime($regSize);
} else {
extract(BigInteger::minMaxBits($bits));
/** @var BigInteger $min
* @var BigInteger $max
*/
list($min) = $min->divide($n);
$min = $min->add(self::$one);
list($max) = $max->divide($n);

View File

@ -88,6 +88,12 @@ abstract class MSBLOB
// PUBLICKEYSTRUC publickeystruc
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa387453(v=vs.85).aspx
extract(unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8)));
/**
* @var string $type
* @var string $version
* @var integer $reserved
* @var integer $algo
*/
switch (ord($type)) {
case self::PUBLICKEYBLOB:
case self::PUBLICKEYBLOBEX:
@ -115,6 +121,11 @@ abstract class MSBLOB
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa387685(v=vs.85).aspx
// could do V for pubexp but that's unsigned 32-bit whereas some PHP installs only do signed 32-bit
extract(unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12)));
/**
* @var integer $magic
* @var integer $bitlen
* @var string $pubexp
*/
switch ($magic) {
case self::RSA2:
$components['isPublicKey'] = false;

View File

@ -63,18 +63,16 @@ abstract class PuTTY extends Progenitor
if ($components === false || !isset($components['private'])) {
return $components;
}
extract($components);
unset($components['public'], $components['private']);
$isPublicKey = false;
$result = Strings::unpackSSH2('ii', $public);
$result = Strings::unpackSSH2('ii', $components['public']);
if ($result === false) {
return false;
}
list($publicExponent, $modulus) = $result;
$result = Strings::unpackSSH2('iiii', $private);
$result = Strings::unpackSSH2('iiii', $components['private']);
if ($result === false) {
return false;
}

View File

@ -292,6 +292,9 @@ abstract class ASN1
$current+= ['headerlength' => $length + 2];
$start+= $length;
extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4)));
/**
* @var integer $length
*/
} else {
$current+= ['headerlength' => 2];
}

View File

@ -299,12 +299,17 @@ class BigInteger implements \Serializable
* Calculates modular inverses.
*
* Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
* @return array
* @return BigInteger[]
* @param BigInteger $n
*/
public function extendedGCD(BigInteger $n)
{
extract($this->value->extendedGCD($n->value));
/**
* @var BigInteger $gcd
* @var BigInteger $x
* @var BigInteger $y
*/
return [
'gcd' => new static($gcd),
'x' => new static($x),
@ -561,12 +566,15 @@ class BigInteger implements \Serializable
* Returns the smallest and largest n-bit number
*
* @param int $bits
* @return array
* @return BigInteger[]
*/
public static function minMaxBits($bits)
{
$class = self::$mainEngine;
extract($class::minMaxBits($bits));
/** @var BigInteger $min
* @var BigInteger $max
*/
return [
'min' => new static($min),
'max' => new static($max)

View File

@ -341,6 +341,9 @@ class BCMath extends Engine
public function gcd(BCMath $n)
{
extract($this->extendedGCD($n));
/**
* @var BCMath $gcd
*/
return $gcd;
}

View File

@ -18,6 +18,7 @@ namespace phpseclib\Math\BigInteger\Engines;
use ParagonIE\ConstantTime\Hex;
use phpseclib\Exception\BadConfigurationException;
use phpseclib\Crypt\Random;
use phpseclib\Math\BigInteger;
/**
* Base Engine.
@ -276,6 +277,10 @@ abstract class Engine implements \Serializable
}
extract($this->extendedGCD($n));
/**
* @var BigInteger $gcd
* @var BigInteger $x
*/
if (!$gcd->equals(static::$one)) {
return false;
@ -517,7 +522,7 @@ abstract class Engine implements \Serializable
* Returns the smallest and largest n-bit number
*
* @param int $bits
* @return \phpseclib\Math\BigInteger\Engines\Engine
* @return \phpseclib\Math\BigInteger\Engines\Engine[]
*/
public static function minMaxBits($bits)
{
@ -670,6 +675,10 @@ abstract class Engine implements \Serializable
public static function random($size)
{
extract(static::minMaxBits($size));
/**
* @var BigInteger $min
* @var BigInteger $max
*/
return static::randomRange($min, $max);
}
@ -684,6 +693,10 @@ abstract class Engine implements \Serializable
public static function randomPrime($size)
{
extract(static::minMaxBits($size));
/**
* @var BigInteger $min
* @var BigInteger $max
*/
return static::randomRangePrime($min, $max);
}

View File

@ -309,7 +309,7 @@ class GMP extends Engine
* {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information.
*
* @param \phpseclib\Math\BigInteger\Engines\GMP $n
* @return \phpseclib\Math\BigInteger\Engines\GMP
* @return \phpseclib\Math\BigInteger\Engines\GMP[]
*/
public function extendedGCD(GMP $n)
{

View File

@ -192,7 +192,8 @@ class PHP32 extends PHP
*/
public function gcd(PHP32 $n)
{
extract($this->extendedGCD($n));
$gcd = $this->extendedGCD($n)['gcd'];
return $gcd;
}

View File

@ -192,7 +192,7 @@ class PHP64 extends PHP
*/
public function gcd(PHP64 $n)
{
extract($this->extendedGCD($n));
$gcd=$this->extendedGCD($n)['gcd'];
return $gcd;
}

View File

@ -307,6 +307,9 @@ class SCP
return false;
}
extract(unpack('Nlength', $response[SSH1::RESPONSE_DATA]));
/**
* @var integer $length
*/
return Strings::shift($response[SSH1::RESPONSE_DATA], $length);
case NET_SSH1_SMSG_STDERR_DATA:
break;

View File

@ -494,17 +494,27 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nversion', Strings::shift($response, 4)));
/**
* @var integer $version
*/
$this->version = $version;
while (!empty($response)) {
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$key = Strings::shift($response, $length);
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$value = Strings::shift($response, $length);
$this->extensions[$key] = $value;
}
@ -638,12 +648,19 @@ class SFTP extends SSH2
return;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
}
$error = $this->status_codes[$status];
if ($this->version > 2 || strlen($response) < 4) {
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$this->sftp_errors[] = $error . ': ' . Strings::shift($response, $length);
} else {
$this->sftp_errors[] = $error;
@ -688,6 +705,10 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
return Strings::shift($response, $length);
case NET_SFTP_STATUS:
$this->logError($response);
@ -927,16 +948,28 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Ncount', Strings::shift($response, 4)));
/**
* @var integer $count
*/
for ($i = 0; $i < $count; $i++) {
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$shortname = Strings::shift($response, $length);
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$longname = Strings::shift($response, $length);
$attributes = $this->parseAttributes($response);
if (!isset($attributes['type'])) {
@ -966,6 +999,10 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_EOF) {
$this->logError($response, $status);
return false;
@ -1567,6 +1604,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
return false;
@ -1683,6 +1723,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Ncount', Strings::shift($response, 4)));
/**
* @var integer $count
*/
// the file isn't a symlink
if (!$count) {
return false;
@ -1692,6 +1735,10 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
return Strings::shift($response, $length);
}
@ -1730,7 +1777,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
return false;
@ -1800,6 +1849,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
return false;
@ -1841,6 +1893,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
// presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED?
$this->logError($response, $status);
@ -2079,6 +2134,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
break;
@ -2114,6 +2172,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
return false;
@ -2319,6 +2380,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
if (!$recursive) {
@ -2749,6 +2813,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nstatus', Strings::shift($response, 4)));
/**
* @var integer $status
*/
if ($status != NET_SFTP_STATUS_OK) {
$this->logError($response, $status);
return false;
@ -2780,6 +2847,9 @@ class SFTP extends SSH2
return [];
}
extract(unpack('Nflags', Strings::shift($response, 4)));
/**
* @var integer $flags
*/
// SFTPv4+ have a type field (a byte) that follows the above flag field
foreach ($this->attributes as $key => $value) {
switch ($flags & $key) {
@ -2826,18 +2896,28 @@ class SFTP extends SSH2
return $attr;
}
extract(unpack('Ncount', Strings::shift($response, 4)));
/**
* @var integer $count
*/
for ($i = 0; $i < $count; $i++) {
if (strlen($response) < 4) {
//user_error('Malformed file attributes');
return $attr;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$key = Strings::shift($response, $length);
if (strlen($response) < 4) {
//user_error('Malformed file attributes');
return $attr;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$attr[$key] = Strings::shift($response, $length);
}
}
@ -2994,6 +3074,9 @@ class SFTP extends SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($this->packet_buffer, 4)));
/**
* @var integer $length
*/
$tempLength = $length;
$tempLength-= strlen($this->packet_buffer);

View File

@ -614,6 +614,9 @@ class SSH1
return false;
}
extract(unpack('Nsupported_ciphers_mask', Strings::shift($response[self::RESPONSE_DATA], 4)));
/**
* @var integer $supported_ciphers_mask
*/
foreach ($this->supported_ciphers as $mask => $name) {
if (($supported_ciphers_mask & (1 << $mask)) == 0) {
@ -626,6 +629,9 @@ class SSH1
return false;
}
extract(unpack('Nsupported_authentications_mask', Strings::shift($response[self::RESPONSE_DATA], 4)));
/**
* @var integer $supported_authentications_mask
*/
foreach ($this->supported_authentications as $mask => $name) {
if (($supported_authentications_mask & (1 << $mask)) == 0) {
unset($this->supported_authentications[$mask]);

View File

@ -1548,7 +1548,7 @@ class SSH2
return false;
}
extract(unpack('Cfirst_kex_packet_follows', Strings::shift($response, 1)));
/** @var integer $first_kex_packet_follows */
$first_kex_packet_follows = $first_kex_packet_follows != 0;
if (!$this->send_kex_first && !$this->send_binary_packet($kexinit_payload_client)) {
@ -1612,6 +1612,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
if ($type != NET_SSH2_MSG_KEXDH_GEX_GROUP) {
user_error('Expected SSH_MSG_KEX_DH_GEX_GROUP');
return false;
@ -1621,6 +1622,7 @@ class SSH2
return false;
}
extract(unpack('NprimeLength', Strings::shift($response, 4)));
/** @var integer $primeLength*/
$primeBytes = Strings::shift($response, $primeLength);
$prime = new BigInteger($primeBytes, -256);
@ -1628,6 +1630,7 @@ class SSH2
return false;
}
extract(unpack('NgLength', Strings::shift($response, 4)));
/** @var integer $gLength */
$gBytes = Strings::shift($response, $gLength);
$g = new BigInteger($gBytes, -256);
@ -1711,7 +1714,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
if ($type != $serverKexReplyMessage) {
throw new \UnexpectedValueException('Expected SSH_MSG_KEXDH_REPLY');
}
@ -1816,7 +1819,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
if ($type != NET_SSH2_MSG_NEWKEYS) {
throw new \UnexpectedValueException('Expected SSH_MSG_NEWKEYS');
}
@ -2183,7 +2186,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
if ($type != NET_SSH2_MSG_SERVICE_ACCEPT) {
throw new \UnexpectedValueException('Expected SSH_MSG_SERVICE_ACCEPT');
}
@ -2233,7 +2236,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
switch ($type) {
case NET_SSH2_MSG_USERAUTH_SUCCESS:
$this->bitmap |= self::MASK_LOGIN;
@ -2290,7 +2293,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
switch ($type) {
case NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: // in theory, the password can be changed
if (defined('NET_SSH2_LOGGING')) {
@ -2301,6 +2304,9 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . utf8_decode(Strings::shift($response, $length));
return $this->disconnect_helper(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER);
@ -2311,11 +2317,18 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$auth_methods = explode(',', Strings::shift($response, $length));
if (!strlen($response)) {
return false;
}
extract(unpack('Cpartial_success', Strings::shift($response, 1)));
/**
* @var integer $partial_success
*/
$partial_success = $partial_success != 0;
if (!$partial_success && in_array('keyboard-interactive', $auth_methods)) {
@ -2391,29 +2404,41 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
switch ($type) {
case NET_SSH2_MSG_USERAUTH_INFO_REQUEST:
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
Strings::shift($response, $length); // name; may be empty
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
Strings::shift($response, $length); // instruction; may be empty
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
Strings::shift($response, $length); // language tag; may be empty
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nnum_prompts', Strings::shift($response, 4)));
/** @var integer $num_prompts */
for ($i = 0; $i < count($responses); $i++) {
if (is_array($responses[$i])) {
foreach ($responses[$i] as $key => $value) {
@ -2430,6 +2455,10 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
// prompt - ie. "Password: "; must not be empty
$prompt = Strings::shift($response, $length);
//$echo = Strings::shift($response) != chr(0);
@ -2578,6 +2607,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
switch ($type) {
case NET_SSH2_MSG_USERAUTH_FAILURE:
@ -2585,6 +2615,10 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$this->errors[] = 'SSH_MSG_USERAUTH_FAILURE: ' . Strings::shift($response, $length);
return false;
@ -2619,6 +2653,7 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
switch ($type) {
case NET_SSH2_MSG_USERAUTH_FAILURE:
@ -3240,6 +3275,10 @@ class SSH2
return false;
}
extract(unpack('Npacket_length/Cpadding_length', Strings::shift($raw, 5)));
/**
* @var integer $packet_length
* @var integer $padding_length
*/
$remaining_length = $packet_length + 4 - $this->decrypt_block_size;
@ -3322,6 +3361,11 @@ class SSH2
return false;
}
extract(unpack('Nreason_code/Nlength', Strings::shift($payload, 8)));
/**
* @var integer $reason_code
* @var integer $length
*/
$this->errors[] = 'SSH_MSG_DISCONNECT: ' . $this->disconnect_reasons[$reason_code] . "\r\n" . utf8_decode(Strings::shift($payload, $length));
$this->bitmap = 0;
return false;
@ -3334,6 +3378,10 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($payload, 4)));
/**
* @var integer $length
*/
$this->errors[] = 'SSH_MSG_DEBUG: ' . utf8_decode(Strings::shift($payload, $length));
$payload = $this->get_binary_packet($skip_channel_filter);
break;
@ -3356,6 +3404,9 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($payload, 4)));
/**
* @var integer $length
*/
$this->banner_message = utf8_decode(Strings::shift($payload, $length));
$payload = $this->get_binary_packet();
}
@ -3379,6 +3430,9 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($payload, 4)));
/**
* @var integer $length
*/
$this->errors[] = 'SSH_MSG_GLOBAL_REQUEST: ' . Strings::shift($payload, $length);
if (!$this->send_binary_packet(pack('C', NET_SSH2_MSG_REQUEST_FAILURE))) {
@ -3393,11 +3447,15 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($payload, 4)));
/**
* @var integer $length
*/
$data = Strings::shift($payload, $length);
if (strlen($payload) < 4) {
return false;
}
extract(unpack('Nserver_channel', Strings::shift($payload, 4)));
/** @var integer $server_channel */
switch ($data) {
case 'auth-agent':
case 'auth-agent@openssh.com':
@ -3408,7 +3466,9 @@ class SSH2
return false;
}
extract(unpack('Nremote_window_size', Strings::shift($payload, 4)));
/** @var integer $remote_window_size */
extract(unpack('Nremote_maximum_packet_size', Strings::shift($payload, 4)));
/** @var integer $remote_maximum_packet_size*/
$this->packet_size_client_to_server[$new_channel] = $remote_window_size;
$this->window_size_server_to_client[$new_channel] = $remote_maximum_packet_size;
@ -3457,7 +3517,9 @@ class SSH2
return false;
}
extract(unpack('Nchannel', Strings::shift($payload, 4)));
/** @var integer $channel */
extract(unpack('Nwindow_size', Strings::shift($payload, 4)));
/** @var integer $window_size */
$this->window_size_client_to_server[$channel]+= $window_size;
@ -3602,14 +3664,19 @@ class SSH2
return false;
}
extract(unpack('Ctype', Strings::shift($response, 1)));
/** @var integer $type */
if (strlen($response) < 4) {
return false;
}
if ($type == NET_SSH2_MSG_CHANNEL_OPEN) {
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
} else {
extract(unpack('Nchannel', Strings::shift($response, 4)));
/** @var integer $channel */
}
// will not be setup yet on incoming channel open request
@ -3636,6 +3703,10 @@ class SSH2
return false;
}
extract(unpack('Ndata_type_code/Nlength', Strings::shift($response, 8)));
/**
* @var integer $data_type_code
* @var integer $length
*/
$data = Strings::shift($response, $length);
$this->stdErrorLog.= $data;
if ($skip_extended || $this->quiet_mode) {
@ -3660,11 +3731,13 @@ class SSH2
return false;
}
extract(unpack('Nserver_channel', Strings::shift($response, 4)));
/** @var integer $server_channel */
$this->server_channels[$channel] = $server_channel;
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nwindow_size', Strings::shift($response, 4)));
/** @var integer $window_size */
if ($window_size < 0) {
$window_size&= 0x7FFFFFFF;
@ -3718,6 +3791,10 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$data = Strings::shift($response, $length);
if ($channel == self::CHANNEL_AGENT_FORWARD) {
@ -3741,6 +3818,9 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$value = Strings::shift($response, $length);
switch ($value) {
case 'exit-signal':
@ -3749,12 +3829,18 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
$this->errors[] = 'SSH_MSG_CHANNEL_REQUEST (exit-signal): ' . Strings::shift($response, $length);
if (strlen($response) < 4) {
return false;
}
Strings::shift($response, 1);
extract(unpack('Nlength', Strings::shift($response, 4)));
/**
* @var integer $length
*/
if ($length) {
$this->errors[count($this->errors)].= "\r\n" . Strings::shift($response, $length);
}
@ -3770,6 +3856,10 @@ class SSH2
return false;
}
extract(unpack('Cfalse/Nexit_status', Strings::shift($response, 5)));
/**
* @var integer $false
* @var integer $exit_status
*/
$this->exit_status = $exit_status;
@ -4385,6 +4475,9 @@ class SSH2
return false;
}
extract(unpack('Nlength', Strings::shift($server_public_host_key, 4)));
/**
* @var integer $length
*/
Strings::shift($server_public_host_key, $length);
if ($this->signature_validated) {