This commit is contained in:
terrafrost 2021-12-15 07:24:06 -06:00
commit f449152c91

View File

@ -61,23 +61,6 @@ use phpseclib\Crypt\Twofish;
use phpseclib\Math\BigInteger; // Used to do Diffie-Hellman key exchange and DSA/RSA signature verification.
use phpseclib\System\SSH\Agent;
/**#@+
* @access private
*/
/**
* No compression
*/
define('NET_SSH2_COMPRESSION_NONE', 1);
/**
* zlib compression
*/
define('NET_SSH2_COMPRESSION_ZLIB', 2);
/**
* zlib@openssh.com
*/
define('NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH', 3);
/**#@-*/
/**
* Pure-PHP implementation of SSHv2.
*
@ -87,6 +70,25 @@ define('NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH', 3);
*/
class SSH2
{
/**#@+
* Compression Types
*
* @access private
*/
/**
* No compression
*/
const NET_SSH2_COMPRESSION_NONE = 1;
/**
* zlib compression
*/
const NET_SSH2_COMPRESSION_ZLIB = 2;
/**
* zlib@openssh.com
*/
const NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH = 3;
/**#@-*/
/**#@+
* Execution Bitmap Masks
*
@ -1002,7 +1004,7 @@ class SSH2
* @var int
* @access private
*/
var $compress = NET_SSH2_COMPRESSION_NONE;
var $compress = self::NET_SSH2_COMPRESSION_NONE;
/**
* Decompression method
@ -1010,7 +1012,7 @@ class SSH2
* @var resource|object
* @access private
*/
var $decompress = NET_SSH2_COMPRESSION_NONE;
var $decompress = self::NET_SSH2_COMPRESSION_NONE;
/**
* Compression context
@ -1644,9 +1646,9 @@ class SSH2
}
$compression_map = array(
'none' => NET_SSH2_COMPRESSION_NONE,
'zlib' => NET_SSH2_COMPRESSION_ZLIB,
'zlib@openssh.com' => NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH
'none' => self::NET_SSH2_COMPRESSION_NONE,
'zlib' => self::NET_SSH2_COMPRESSION_ZLIB,
'zlib@openssh.com' => self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH
);
$compression_algorithm_out = $this->_array_intersect_first($c2s_compression_algorithms, $this->compression_algorithms_client_to_server);
@ -3589,11 +3591,11 @@ class SSH2
}
switch ($this->decompress) {
case NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH:
case self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH:
if (!$this->isAuthenticated()) {
break;
}
case NET_SSH2_COMPRESSION_ZLIB:
case self::NET_SSH2_COMPRESSION_ZLIB:
if ($this->regenerate_decompression_context) {
$this->regenerate_decompression_context = false;
@ -4181,11 +4183,11 @@ class SSH2
}
switch ($this->compress) {
case NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH:
case self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH:
if (!$this->isAuthenticated()) {
break;
}
case NET_SSH2_COMPRESSION_ZLIB:
case self::NET_SSH2_COMPRESSION_ZLIB:
if (!$this->regenerate_compression_context) {
$header = '';
} else {
@ -4943,9 +4945,9 @@ class SSH2
$this->_connect();
$compression_map = array(
NET_SSH2_COMPRESSION_NONE => 'none',
NET_SSH2_COMPRESSION_ZLIB => 'zlib',
NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH => 'zlib@openssh.com'
self::NET_SSH2_COMPRESSION_NONE => 'none',
self::NET_SSH2_COMPRESSION_ZLIB => 'zlib',
self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH => 'zlib@openssh.com'
);
return array(