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