diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-30 13:58:20 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-30 13:58:20 +0000 |
commit | 567cc5984abc6b1380f8a807a0a8f197bb8a3b93 (patch) | |
tree | e8a58771a88ff810214c93ed27db853a632a4abb /libssh/auth.c | |
parent | 06a0dea2add09bdadc870a7f664c17c00a326f89 (diff) | |
download | libssh-567cc5984abc6b1380f8a807a0a8f197bb8a3b93.tar.gz libssh-567cc5984abc6b1380f8a807a0a8f197bb8a3b93.tar.xz libssh-567cc5984abc6b1380f8a807a0a8f197bb8a3b93.zip |
Improve the autopubkey authentication.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@658 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/auth.c')
-rw-r--r-- | libssh/auth.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libssh/auth.c b/libssh/auth.c index ea25134..235ec23 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -738,7 +738,7 @@ int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) { char *privkeyfile = NULL; char *id = NULL; size_t size; - unsigned int count = 0; + unsigned int i = 0; int type = 0; int rc; @@ -834,8 +834,15 @@ int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) { keytab[size - 1].public = id; } - while ((pubkey = publickey_from_next_file(session, keytab, size, - &privkeyfile, &type, &count))) { + for (i = 0, pubkey = try_publickey_from_file(session, keytab[i], + &privkeyfile, &type); + i < size; + pubkey = try_publickey_from_file(session, keytab[++i], + &privkeyfile, &type)) { + if (pubkey == NULL) { + continue; + } + rc = ssh_userauth_offer_pubkey(session, NULL, type, pubkey); if (rc == SSH_AUTH_ERROR){ if (id != NULL) { |