Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2024-05-18 20:25:32 -05:00
commit a134f1c8d4

View File

@ -1005,7 +1005,7 @@ class SSH2
* @var bool
* @access private
*/
var $retry_connect = false;
var $login_credentials_finalized = false;
/**
* Binary Packet Buffer
@ -2292,7 +2292,7 @@ class SSH2
function login($username)
{
$args = func_get_args();
if (!$this->retry_connect) {
if (!$this->login_credentials_finalized) {
$this->auth[] = $args;
}
@ -2383,6 +2383,7 @@ class SSH2
foreach ($newargs as $arg) {
if ($this->_login_helper($username, $arg)) {
$this->login_credentials_finalized = true;
return true;
}
}
@ -2418,10 +2419,14 @@ class SSH2
return false;
}
$bad_key_size_fix = $this->bad_key_size_fix;
$response = $this->_get_binary_packet();
if ($response === false) {
if ($this->retry_connect) {
$this->retry_connect = false;
// bad_key_size_fix is only ever re-assigned to true
// under certain conditions. when it's newly set we'll
// retry the connection with that new setting but we'll
// only try it once.
if ($bad_key_size_fix != $this->bad_key_size_fix) {
if (!$this->_connect()) {
return false;
}
@ -3553,7 +3558,6 @@ class SSH2
function _reconnect()
{
$this->_reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST);
$this->retry_connect = true;
if (!$this->_connect()) {
return false;
}
@ -3577,7 +3581,6 @@ class SSH2
$this->hmac_check = $this->hmac_create = false;
$this->hmac_size = false;
$this->session_id = false;
$this->retry_connect = true;
$this->get_seq_no = $this->send_seq_no = 0;
}