diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-30 14:20:47 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-30 14:20:47 +0000 |
commit | 83971c01886bfe3bc6a38949fa1dcd846319d78c (patch) | |
tree | f7912f88ae15bb7812ee234c18272e100f1aeb6f /libssh | |
parent | cc6199d9f0e40e7d2829e63a9d5a2c0852714cdc (diff) | |
download | libssh-83971c01886bfe3bc6a38949fa1dcd846319d78c.tar.gz libssh-83971c01886bfe3bc6a38949fa1dcd846319d78c.tar.xz libssh-83971c01886bfe3bc6a38949fa1dcd846319d78c.zip |
Improve ssh_userauth_list().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@664 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/auth.c | 14 |
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 */ |