comparison cli-authpubkey.c @ 62:20563735e8b5

just checkpointing
author Matt Johnston <matt@ucc.asn.au>
date Tue, 10 Aug 2004 17:09:52 +0000
parents 4b53a43f0082
children eee77ac31ccc
comparison
equal deleted inserted replaced
61:3a4f0ef1e8c3 62:20563735e8b5
11 /* Called when we receive a SSH_MSG_USERAUTH_FAILURE for a pubkey request. 11 /* Called when we receive a SSH_MSG_USERAUTH_FAILURE for a pubkey request.
12 * We use it to remove the key we tried from the list */ 12 * We use it to remove the key we tried from the list */
13 void cli_pubkeyfail() { 13 void cli_pubkeyfail() {
14 14
15 struct PubkeyList *keyitem; 15 struct PubkeyList *keyitem;
16 struct PubkeyList **previtem;
16 17
17 TRACE(("enter cli_pubkeyfail")); 18 TRACE(("enter cli_pubkeyfail"));
19 previtem = &cli_opts.pubkeys;
20
18 /* Find the key we failed with, and remove it */ 21 /* Find the key we failed with, and remove it */
19 for (keyitem = cli_opts.pubkeys; keyitem != NULL; keyitem = keyitem->next) { 22 for (keyitem = cli_opts.pubkeys; keyitem != NULL; keyitem = keyitem->next) {
20 if (keyitem->next == cli_ses.lastpubkey) { 23 if (keyitem == cli_ses.lastpubkey) {
21 keyitem->next = cli_ses.lastpubkey->next; 24 *previtem = keyitem->next;
22 } 25 }
26 previtem = &keyitem;
23 } 27 }
24 28
25 sign_key_free(cli_ses.lastpubkey->key); /* It won't be used again */ 29 sign_key_free(cli_ses.lastpubkey->key); /* It won't be used again */
26 m_free(cli_ses.lastpubkey); 30 m_free(cli_ses.lastpubkey);
31
27 TRACE(("leave cli_pubkeyfail")); 32 TRACE(("leave cli_pubkeyfail"));
28 } 33 }
29 34
30 void recv_msg_userauth_pk_ok() { 35 void recv_msg_userauth_pk_ok() {
31 36
143 148
144 if (cli_opts.pubkeys != NULL) { 149 if (cli_opts.pubkeys != NULL) {
145 /* Send a trial request */ 150 /* Send a trial request */
146 send_msg_userauth_pubkey(cli_opts.pubkeys->key, 151 send_msg_userauth_pubkey(cli_opts.pubkeys->key,
147 cli_opts.pubkeys->type, 0); 152 cli_opts.pubkeys->type, 0);
153 cli_ses.lastpubkey = cli_opts.pubkeys;
148 TRACE(("leave cli_auth_pubkey-success")); 154 TRACE(("leave cli_auth_pubkey-success"));
149 return 1; 155 return 1;
150 } else { 156 } else {
151 TRACE(("leave cli_auth_pubkey-failure")); 157 TRACE(("leave cli_auth_pubkey-failure"));
152 return 0; 158 return 0;