comparison cli-authpubkey.c @ 215:aad4b3f58556

rename PubkeyList to SignKeyList for clarity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 08 Jul 2005 11:32:09 +0000
parents 0cfba3034be5
children ca7e76d981d9 454a34b2dfd1 2448ae3e75b5
comparison
equal deleted inserted replaced
214:5a75f8a21503 215:aad4b3f58556
36 36
37 /* Called when we receive a SSH_MSG_USERAUTH_FAILURE for a pubkey request. 37 /* Called when we receive a SSH_MSG_USERAUTH_FAILURE for a pubkey request.
38 * We use it to remove the key we tried from the list */ 38 * We use it to remove the key we tried from the list */
39 void cli_pubkeyfail() { 39 void cli_pubkeyfail() {
40 40
41 struct PubkeyList *keyitem; 41 struct SignKeyList *keyitem;
42 struct PubkeyList **previtem; 42 struct SignKeyList **previtem;
43 43
44 TRACE(("enter cli_pubkeyfail")) 44 TRACE(("enter cli_pubkeyfail"))
45 previtem = &cli_opts.pubkeys; 45 previtem = &cli_opts.privkeys;
46 46
47 /* Find the key we failed with, and remove it */ 47 /* Find the key we failed with, and remove it */
48 for (keyitem = cli_opts.pubkeys; keyitem != NULL; keyitem = keyitem->next) { 48 for (keyitem = cli_opts.privkeys; keyitem != NULL; keyitem = keyitem->next) {
49 if (keyitem == cli_ses.lastpubkey) { 49 if (keyitem == cli_ses.lastprivkey) {
50 *previtem = keyitem->next; 50 *previtem = keyitem->next;
51 } 51 }
52 previtem = &keyitem; 52 previtem = &keyitem;
53 } 53 }
54 54
55 sign_key_free(cli_ses.lastpubkey->key); /* It won't be used again */ 55 sign_key_free(cli_ses.lastprivkey->key); /* It won't be used again */
56 m_free(cli_ses.lastpubkey); 56 m_free(cli_ses.lastprivkey);
57 57
58 TRACE(("leave cli_pubkeyfail")) 58 TRACE(("leave cli_pubkeyfail"))
59 } 59 }
60 60
61 void recv_msg_userauth_pk_ok() { 61 void recv_msg_userauth_pk_ok() {
62 62
63 struct PubkeyList *keyitem; 63 struct SignKeyList *keyitem;
64 buffer* keybuf; 64 buffer* keybuf;
65 char* algotype = NULL; 65 char* algotype = NULL;
66 unsigned int algolen; 66 unsigned int algolen;
67 int keytype; 67 int keytype;
68 unsigned int remotelen; 68 unsigned int remotelen;
78 78
79 remotelen = buf_getint(ses.payload); 79 remotelen = buf_getint(ses.payload);
80 80
81 /* Iterate through our keys, find which one it was that matched, and 81 /* Iterate through our keys, find which one it was that matched, and
82 * send a real request with that key */ 82 * send a real request with that key */
83 for (keyitem = cli_opts.pubkeys; keyitem != NULL; keyitem = keyitem->next) { 83 for (keyitem = cli_opts.privkeys; keyitem != NULL; keyitem = keyitem->next) {
84 84
85 if (keyitem->type != keytype) { 85 if (keyitem->type != keytype) {
86 /* Types differed */ 86 /* Types differed */
87 TRACE(("types differed")) 87 TRACE(("types differed"))
88 continue; 88 continue;
170 170
171 int cli_auth_pubkey() { 171 int cli_auth_pubkey() {
172 172
173 TRACE(("enter cli_auth_pubkey")) 173 TRACE(("enter cli_auth_pubkey"))
174 174
175 if (cli_opts.pubkeys != NULL) { 175 if (cli_opts.privkeys != NULL) {
176 /* Send a trial request */ 176 /* Send a trial request */
177 send_msg_userauth_pubkey(cli_opts.pubkeys->key, 177 send_msg_userauth_pubkey(cli_opts.privkeys->key,
178 cli_opts.pubkeys->type, 0); 178 cli_opts.privkeys->type, 0);
179 cli_ses.lastpubkey = cli_opts.pubkeys; 179 cli_ses.lastprivkey = cli_opts.privkeys;
180 TRACE(("leave cli_auth_pubkey-success")) 180 TRACE(("leave cli_auth_pubkey-success"))
181 return 1; 181 return 1;
182 } else { 182 } else {
183 TRACE(("leave cli_auth_pubkey-failure")) 183 TRACE(("leave cli_auth_pubkey-failure"))
184 return 0; 184 return 0;