From 83971c01886bfe3bc6a38949fa1dcd846319d78c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 30 Apr 2009 14:20:47 +0000 Subject: Improve ssh_userauth_list(). git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@664 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/auth.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libssh') 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 */ -- cgit