Merge branch '2.0'

This commit is contained in:
terrafrost 2019-09-10 18:13:12 -05:00
commit 71aa8165fa
2 changed files with 24 additions and 4 deletions

View File

@ -414,6 +414,7 @@ class SFTP extends SSH2
*/
public function login($username, ...$args)
{
$this->auth[] = $args;
if (!$this->sublogin($username, ...$args)) {
return false;
}
@ -2878,6 +2879,20 @@ class SFTP extends SSH2
return $result;
}
/**
* Resets a connection for re-use
*
* @param int $reason
* @access private
*/
protected function reset_connection($reason)
{
parent::reset_connection($reason);
$this->use_request_id = false;
$this->pwd = false;
$this->requestBuffer = [];
}
/**
* Receives SFTP Packets
*

View File

@ -3051,6 +3051,9 @@ class SSH2
public function ping()
{
if (!$this->isAuthenticated()) {
if (!empty($this->auth)) {
return $this->reconnect();
}
return false;
}
@ -3103,7 +3106,7 @@ class SSH2
* @param int $reason
* @access private
*/
private function reset_connection($reason)
protected function reset_connection($reason)
{
$this->disconnect_helper($reason);
$this->decrypt = $this->encrypt = false;
@ -4020,10 +4023,12 @@ class SSH2
if ($this->bitmap & self::MASK_CONNECTED) {
$data = Strings::packSSH2('CNss', NET_SSH2_MSG_DISCONNECT, $reason, '', '');
$this->send_binary_packet($data);
$this->bitmap = 0;
fclose($this->fsock);
return false;
}
$this->bitmap = 0;
fclose($this->fsock);
return false;
}
/**