mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-28 01:28:27 +00:00
Merge branch '2.0' into 3.0
This commit is contained in:
commit
787d0fdc1f
@ -1000,7 +1000,7 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $retry_connect = false;
|
private $login_credentials_finalized = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binary Packet Buffer
|
* Binary Packet Buffer
|
||||||
@ -2216,7 +2216,7 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
public function login($username, ...$args)
|
public function login($username, ...$args)
|
||||||
{
|
{
|
||||||
if (!$this->retry_connect) {
|
if (!$this->login_credentials_finalized) {
|
||||||
$this->auth[] = func_get_args();
|
$this->auth[] = func_get_args();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2319,6 +2319,7 @@ class SSH2
|
|||||||
|
|
||||||
foreach ($newargs as $arg) {
|
foreach ($newargs as $arg) {
|
||||||
if ($this->login_helper($username, $arg)) {
|
if ($this->login_helper($username, $arg)) {
|
||||||
|
$this->login_credentials_finalized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2349,10 +2350,14 @@ class SSH2
|
|||||||
$this->send_binary_packet($packet);
|
$this->send_binary_packet($packet);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$bad_key_size_fix = $this->bad_key_size_fix;
|
||||||
$response = $this->get_binary_packet();
|
$response = $this->get_binary_packet();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if ($this->retry_connect) {
|
// bad_key_size_fix is only ever re-assigned to true
|
||||||
$this->retry_connect = false;
|
// 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) {
|
||||||
$this->connect();
|
$this->connect();
|
||||||
return $this->login_helper($username, $password);
|
return $this->login_helper($username, $password);
|
||||||
}
|
}
|
||||||
@ -3467,7 +3472,6 @@ class SSH2
|
|||||||
private function reconnect()
|
private function reconnect()
|
||||||
{
|
{
|
||||||
$this->reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST);
|
$this->reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST);
|
||||||
$this->retry_connect = true;
|
|
||||||
$this->connect();
|
$this->connect();
|
||||||
foreach ($this->auth as $auth) {
|
foreach ($this->auth as $auth) {
|
||||||
$result = $this->login(...$auth);
|
$result = $this->login(...$auth);
|
||||||
@ -3488,7 +3492,6 @@ class SSH2
|
|||||||
$this->hmac_check = $this->hmac_create = false;
|
$this->hmac_check = $this->hmac_create = false;
|
||||||
$this->hmac_size = false;
|
$this->hmac_size = false;
|
||||||
$this->session_id = false;
|
$this->session_id = false;
|
||||||
$this->retry_connect = true;
|
|
||||||
$this->get_seq_no = $this->send_seq_no = 0;
|
$this->get_seq_no = $this->send_seq_no = 0;
|
||||||
$this->channel_status = [];
|
$this->channel_status = [];
|
||||||
$this->channel_id_last_interactive = 0;
|
$this->channel_id_last_interactive = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user