Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2019-09-10 17:43:41 -05:00
commit 2cf180fb47
2 changed files with 23 additions and 3 deletions

View File

@ -410,6 +410,7 @@ class SFTP extends SSH2
function login($username) function login($username)
{ {
$args = func_get_args(); $args = func_get_args();
$this->auth[] = $args;
if (!call_user_func_array(array(&$this, '_login'), $args)) { if (!call_user_func_array(array(&$this, '_login'), $args)) {
return false; return false;
} }
@ -2975,6 +2976,20 @@ class SFTP extends SSH2
return $result; return $result;
} }
/**
* Resets a connection for re-use
*
* @param int $reason
* @access private
*/
function _reset_connection($reason)
{
parent::_reset_connection($reason);
$this->use_request_id = false;
$this->pwd = false;
$this->requestBuffer = array();
}
/** /**
* Receives SFTP Packets * Receives SFTP Packets
* *

View File

@ -3206,6 +3206,9 @@ class SSH2
function ping() function ping()
{ {
if (!$this->isAuthenticated()) { if (!$this->isAuthenticated()) {
if (!empty($this->auth)) {
return $this->_reconnect();
}
return false; return false;
} }
@ -4113,10 +4116,12 @@ class SSH2
if ($this->bitmap & self::MASK_CONNECTED) { if ($this->bitmap & self::MASK_CONNECTED) {
$data = pack('CNNa*Na*', NET_SSH2_MSG_DISCONNECT, $reason, 0, '', 0, ''); $data = pack('CNNa*Na*', NET_SSH2_MSG_DISCONNECT, $reason, 0, '', 0, '');
$this->_send_binary_packet($data); $this->_send_binary_packet($data);
$this->bitmap = 0;
fclose($this->fsock);
return false;
} }
$this->bitmap = 0;
fclose($this->fsock);
return false;
} }
/** /**