Improve the autopubkey authentication.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@658 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-30 13:58:20 +00:00
parent 06a0dea2ad
commit 567cc5984a
5 changed files with 22 additions and 33 deletions

View File

@@ -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) {