summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index 2ef4201ce..f38fdf9a0 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.126 2003/10/07 21:58:28 deraadt Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.127 2003/10/11 08:26:43 markus Exp $");
27 27
28#include "openbsd-compat/sys-queue.h" 28#include "openbsd-compat/sys-queue.h"
29 29
@@ -453,7 +453,12 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
453 debug2("input_userauth_pk_ok: fp %s", fp); 453 debug2("input_userauth_pk_ok: fp %s", fp);
454 xfree(fp); 454 xfree(fp);
455 455
456 TAILQ_FOREACH(id, &authctxt->keys, next) { 456 /*
457 * search keys in the reverse order, because last candidate has been
458 * moved to the end of the queue. this also avoids confusion by
459 * duplicate keys
460 */
461 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, next, idlist) {
457 if (key_equal(key, id->key)) { 462 if (key_equal(key, id->key)) {
458 sent = sign_and_send_pubkey(authctxt, id); 463 sent = sign_and_send_pubkey(authctxt, id);
459 break; 464 break;
@@ -1086,6 +1091,7 @@ userauth_pubkey(Authctxt *authctxt)
1086 while ((id = TAILQ_FIRST(&authctxt->keys))) { 1091 while ((id = TAILQ_FIRST(&authctxt->keys))) {
1087 if (id->tried++) 1092 if (id->tried++)
1088 return (0); 1093 return (0);
1094 /* move key to the end of the queue */
1089 TAILQ_REMOVE(&authctxt->keys, id, next); 1095 TAILQ_REMOVE(&authctxt->keys, id, next);
1090 TAILQ_INSERT_TAIL(&authctxt->keys, id, next); 1096 TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
1091 /* 1097 /*