--- sshconnect2.c	Sun Jun 13 14:53:24 2004
+++ sshconnect2.c	Mon Jan 19 22:25:15 2004
@@ -457,7 +456,7 @@
 	 * moved to the end of the queue.  this also avoids confusion by
 	 * duplicate keys
 	 */
-	TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) {
+	TAILQ_FOREACH_REVERSE(id, &authctxt->keys, next, idlist) {
 		if (key_equal(key, id->key)) {
 			sent = sign_and_send_pubkey(authctxt, id);
 			break;
