1
1

auth: Update ssh_userauth_list().

Этот коммит содержится в:
Andreas Schneider 2011-08-23 16:27:03 +02:00
родитель 2e577cecb4
Коммит 5695f92e22

Просмотреть файл

@ -298,29 +298,39 @@ static int wait_auth_status(ssh_session session) {
} }
/** /**
* @brief retrieves available authentication methods for this session * @brief Get available authentication methods from the server.
* @param[in] session the SSH session *
* This requires the function ssh_userauth_none() to be called before the
* methods are available. The server MAY return a list of methods that may
* continue.
*
* @param[in] session The SSH session.
*
* @param[in] username Deprecated, set to NULL. * @param[in] username Deprecated, set to NULL.
* @returns A bitfield of values SSH_AUTH_METHOD_PASSWORD, *
SSH_AUTH_METHOD_PUBLICKEY, SSH_AUTH_METHOD_HOSTBASED, * @returns A bitfield of the fllowing values:
SSH_AUTH_METHOD_INTERACTIVE. * - SSH_AUTH_METHOD_PASSWORD
@warning Other reserved flags may appear in future versions. * - SSH_AUTH_METHOD_PUBLICKEY
@warning This call will block, even in nonblocking mode, if run for the first * - SSH_AUTH_METHOD_HOSTBASED
time before a (complete) call to ssh_userauth_none. * - SSH_AUTH_METHOD_INTERACTIVE
*
* @warning Other reserved flags may appear in future versions.
* @see ssh_userauth_none()
*/ */
int ssh_userauth_list(ssh_session session, const char *username) { int ssh_userauth_list(ssh_session session, const char *username)
{
(void) username; /* unused */
if (session == NULL) { if (session == NULL) {
return SSH_AUTH_ERROR; return 0;
} }
#ifdef WITH_SSH1 #ifdef WITH_SSH1
if(session->version==1){ if(session->version == 1) {
return SSH_AUTH_METHOD_PASSWORD; return SSH_AUTH_METHOD_PASSWORD;
} }
#endif #endif
if (session->auth_methods == 0) {
ssh_userauth_none(session, username);
}
return session->auth_methods; return session->auth_methods;
} }