mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-14 02:11:20 +00:00
Merge pull request #427 from terrafrost/ssh2-show-methods-before-login
SSH2: make it so negotiated algorithms can be seen before login * terrafrost/ssh2-show-methods-before-login: SSH2: white space adjustment SSH: update getServerPublicHostKey() to use new _connect() method SSH2: fix if statement for conditional _connect() call simplify calls to $this->_connect() SSH2: make it so negotiated algorithms can be seen before login
This commit is contained in:
commit
1de939fb4a
@ -191,100 +191,100 @@ class Net_SSH2
|
|||||||
* Server Identifier
|
* Server Identifier
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getServerIdentification()
|
* @see Net_SSH2::getServerIdentification()
|
||||||
* @var String
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $server_identifier = '';
|
var $server_identifier = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key Exchange Algorithms
|
* Key Exchange Algorithms
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getKexAlgorithims()
|
* @see Net_SSH2::getKexAlgorithims()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $kex_algorithms;
|
var $kex_algorithms = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Host Key Algorithms
|
* Server Host Key Algorithms
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getServerHostKeyAlgorithms()
|
* @see Net_SSH2::getServerHostKeyAlgorithms()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $server_host_key_algorithms;
|
var $server_host_key_algorithms = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encryption Algorithms: Client to Server
|
* Encryption Algorithms: Client to Server
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getEncryptionAlgorithmsClient2Server()
|
* @see Net_SSH2::getEncryptionAlgorithmsClient2Server()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $encryption_algorithms_client_to_server;
|
var $encryption_algorithms_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encryption Algorithms: Server to Client
|
* Encryption Algorithms: Server to Client
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getEncryptionAlgorithmsServer2Client()
|
* @see Net_SSH2::getEncryptionAlgorithmsServer2Client()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $encryption_algorithms_server_to_client;
|
var $encryption_algorithms_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MAC Algorithms: Client to Server
|
* MAC Algorithms: Client to Server
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getMACAlgorithmsClient2Server()
|
* @see Net_SSH2::getMACAlgorithmsClient2Server()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $mac_algorithms_client_to_server;
|
var $mac_algorithms_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MAC Algorithms: Server to Client
|
* MAC Algorithms: Server to Client
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getMACAlgorithmsServer2Client()
|
* @see Net_SSH2::getMACAlgorithmsServer2Client()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $mac_algorithms_server_to_client;
|
var $mac_algorithms_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression Algorithms: Client to Server
|
* Compression Algorithms: Client to Server
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getCompressionAlgorithmsClient2Server()
|
* @see Net_SSH2::getCompressionAlgorithmsClient2Server()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $compression_algorithms_client_to_server;
|
var $compression_algorithms_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression Algorithms: Server to Client
|
* Compression Algorithms: Server to Client
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getCompressionAlgorithmsServer2Client()
|
* @see Net_SSH2::getCompressionAlgorithmsServer2Client()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $compression_algorithms_server_to_client;
|
var $compression_algorithms_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Languages: Server to Client
|
* Languages: Server to Client
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getLanguagesServer2Client()
|
* @see Net_SSH2::getLanguagesServer2Client()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $languages_server_to_client;
|
var $languages_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Languages: Client to Server
|
* Languages: Client to Server
|
||||||
*
|
*
|
||||||
* @see Net_SSH2::getLanguagesClient2Server()
|
* @see Net_SSH2::getLanguagesClient2Server()
|
||||||
* @var Array
|
* @var mixed false or Array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $languages_client_to_server;
|
var $languages_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block Size for Server to Client Encryption
|
* Block Size for Server to Client Encryption
|
||||||
@ -949,6 +949,12 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function _connect()
|
function _connect()
|
||||||
{
|
{
|
||||||
|
if ($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->bitmap |= NET_SSH2_MASK_CONSTRUCTOR;
|
||||||
|
|
||||||
$timeout = $this->connectionTimeout;
|
$timeout = $this->connectionTimeout;
|
||||||
$host = $this->host . ':' . $this->port;
|
$host = $this->host . ':' . $this->port;
|
||||||
|
|
||||||
@ -1811,7 +1817,6 @@ class Net_SSH2
|
|||||||
function _login($username)
|
function _login($username)
|
||||||
{
|
{
|
||||||
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
|
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
|
||||||
$this->bitmap |= NET_SSH2_MASK_CONSTRUCTOR;
|
|
||||||
if (!$this->_connect()) {
|
if (!$this->_connect()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3522,6 +3527,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getServerIdentification()
|
function getServerIdentification()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->server_identifier;
|
return $this->server_identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3533,6 +3540,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getKexAlgorithms()
|
function getKexAlgorithms()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->kex_algorithms;
|
return $this->kex_algorithms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3544,6 +3553,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getServerHostKeyAlgorithms()
|
function getServerHostKeyAlgorithms()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->server_host_key_algorithms;
|
return $this->server_host_key_algorithms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3555,6 +3566,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getEncryptionAlgorithmsClient2Server()
|
function getEncryptionAlgorithmsClient2Server()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->encryption_algorithms_client_to_server;
|
return $this->encryption_algorithms_client_to_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3566,6 +3579,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getEncryptionAlgorithmsServer2Client()
|
function getEncryptionAlgorithmsServer2Client()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->encryption_algorithms_server_to_client;
|
return $this->encryption_algorithms_server_to_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3577,6 +3592,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getMACAlgorithmsClient2Server()
|
function getMACAlgorithmsClient2Server()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->mac_algorithms_client_to_server;
|
return $this->mac_algorithms_client_to_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3588,6 +3605,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getMACAlgorithmsServer2Client()
|
function getMACAlgorithmsServer2Client()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->mac_algorithms_server_to_client;
|
return $this->mac_algorithms_server_to_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3599,6 +3618,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getCompressionAlgorithmsClient2Server()
|
function getCompressionAlgorithmsClient2Server()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->compression_algorithms_client_to_server;
|
return $this->compression_algorithms_client_to_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3610,6 +3631,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getCompressionAlgorithmsServer2Client()
|
function getCompressionAlgorithmsServer2Client()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->compression_algorithms_server_to_client;
|
return $this->compression_algorithms_server_to_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3621,6 +3644,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getLanguagesServer2Client()
|
function getLanguagesServer2Client()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->languages_server_to_client;
|
return $this->languages_server_to_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3632,6 +3657,8 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
function getLanguagesClient2Server()
|
function getLanguagesClient2Server()
|
||||||
{
|
{
|
||||||
|
$this->_connect();
|
||||||
|
|
||||||
return $this->languages_client_to_server;
|
return $this->languages_client_to_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3661,7 +3688,6 @@ class Net_SSH2
|
|||||||
function getServerPublicHostKey()
|
function getServerPublicHostKey()
|
||||||
{
|
{
|
||||||
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
|
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
|
||||||
$this->bitmap |= NET_SSH2_MASK_CONSTRUCTOR;
|
|
||||||
if (!$this->_connect()) {
|
if (!$this->_connect()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user