aboutsummaryrefslogtreecommitdiff
path: root/src/auth.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-23 16:27:03 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-23 21:54:01 +0200
commit5695f92e221a427e88675213fdbc286ce8714e18 (patch)
tree50b158de93589a923e013330bd6dd2c576a936dd /src/auth.c
parent2e577cecb4aabc42c5301dd76c768e34eb741fb8 (diff)
downloadlibssh-5695f92e221a427e88675213fdbc286ce8714e18.tar.gz
libssh-5695f92e221a427e88675213fdbc286ce8714e18.tar.xz
libssh-5695f92e221a427e88675213fdbc286ce8714e18.zip
auth: Update ssh_userauth_list().
Diffstat (limited to 'src/auth.c')
-rw-r--r--src/auth.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/auth.c b/src/auth.c
index 8f6be48..97c56ee 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -298,30 +298,40 @@ static int wait_auth_status(ssh_session session) {
}
/**
- * @brief retrieves available authentication methods for this session
- * @param[in] session the SSH session
- * @param[in] username Deprecated, set to NULL.
- * @returns A bitfield of values SSH_AUTH_METHOD_PASSWORD,
- SSH_AUTH_METHOD_PUBLICKEY, SSH_AUTH_METHOD_HOSTBASED,
- SSH_AUTH_METHOD_INTERACTIVE.
- @warning Other reserved flags may appear in future versions.
- @warning This call will block, even in nonblocking mode, if run for the first
- time before a (complete) call to ssh_userauth_none.
+ * @brief Get available authentication methods from the server.
+ *
+ * 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.
+ *
+ * @returns A bitfield of the fllowing values:
+ * - SSH_AUTH_METHOD_PASSWORD
+ * - SSH_AUTH_METHOD_PUBLICKEY
+ * - SSH_AUTH_METHOD_HOSTBASED
+ * - 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) {
- if (session == NULL) {
- return SSH_AUTH_ERROR;
- }
+int ssh_userauth_list(ssh_session session, const char *username)
+{
+ (void) username; /* unused */
+
+ if (session == NULL) {
+ return 0;
+ }
#ifdef WITH_SSH1
- if(session->version==1){
- return SSH_AUTH_METHOD_PASSWORD;
- }
+ if(session->version == 1) {
+ return SSH_AUTH_METHOD_PASSWORD;
+ }
#endif
- if (session->auth_methods == 0) {
- ssh_userauth_none(session, username);
- }
- return session->auth_methods;
+
+ return session->auth_methods;
}
/* use the "none" authentication question */