summaryrefslogtreecommitdiffstats
path: root/libssh/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/auth.c')
-rw-r--r--libssh/auth.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libssh/auth.c b/libssh/auth.c
index e094562..616cfcf 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -168,10 +168,16 @@ int ssh_auth_list(SSH_SESSION *session) {
return session->auth_methods;
}
-int ssh_userauth_list(SSH_SESSION *session, const char *username){
- if(session->auth_methods==0)
- ssh_userauth_none(session,username);
- return ssh_auth_list(session);
+int ssh_userauth_list(SSH_SESSION *session, const char *username) {
+ if (session == NULL || username == NULL) {
+ return SSH_AUTH_ERROR;
+ }
+
+ if (session->auth_methods == 0) {
+ ssh_userauth_none(session, username);
+ }
+
+ return ssh_auth_list(session);
}
/* use the "none" authentication question */