mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-11 08:10:58 +00:00
Make it so none is a supported authentication method
This commit is contained in:
parent
875cef8bbd
commit
346bc5dcc8
@ -1441,7 +1441,7 @@ class Net_SSH2 {
|
|||||||
* @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis}
|
* @internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis}
|
||||||
* by sending dummy SSH_MSG_IGNORE messages.
|
* by sending dummy SSH_MSG_IGNORE messages.
|
||||||
*/
|
*/
|
||||||
function login($username, $password = '')
|
function login($username, $password = null)
|
||||||
{
|
{
|
||||||
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
|
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
|
||||||
return false;
|
return false;
|
||||||
@ -1473,6 +1473,34 @@ class Net_SSH2 {
|
|||||||
return $this->_privatekey_login($username, $password);
|
return $this->_privatekey_login($username, $password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($password)) {
|
||||||
|
$packet = pack('CNa*Na*Na*CNa*',
|
||||||
|
NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection',
|
||||||
|
strlen('none'), 'none'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$this->_send_binary_packet($packet)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->_get_binary_packet();
|
||||||
|
if ($response === false) {
|
||||||
|
user_error('Connection closed by server', E_USER_NOTICE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
extract(unpack('Ctype', $this->_string_shift($response, 1)));
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case NET_SSH2_MSG_USERAUTH_SUCCESS:
|
||||||
|
$this->bitmap |= NET_SSH2_MASK_LOGIN;
|
||||||
|
return true;
|
||||||
|
//case NET_SSH2_MSG_USERAUTH_FAILURE:
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$packet = pack('CNa*Na*Na*CNa*',
|
$packet = pack('CNa*Na*Na*CNa*',
|
||||||
NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection',
|
NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection',
|
||||||
strlen('password'), 'password', 0, strlen($password), $password
|
strlen('password'), 'password', 0, strlen($password), $password
|
||||||
|
Loading…
Reference in New Issue
Block a user