comparison cli-authpubkey.c @ 552:de3653483ac0 agent-client

- Client auth using an agent's key works. Still need to implement client agent forwarding.
author Matt Johnston <matt@ucc.asn.au>
date Mon, 06 Jul 2009 14:02:45 +0000
parents c3f2ec71e3d4
children 52d7301e46bd
comparison
equal deleted inserted replaced
551:c3f2ec71e3d4 552:de3653483ac0
172 /* We put the signature as well - this contains string(session id), then 172 /* We put the signature as well - this contains string(session id), then
173 * the contents of the write payload to this point */ 173 * the contents of the write payload to this point */
174 sigbuf = buf_new(4 + SHA1_HASH_SIZE + ses.writepayload->len); 174 sigbuf = buf_new(4 + SHA1_HASH_SIZE + ses.writepayload->len);
175 buf_putstring(sigbuf, ses.session_id, SHA1_HASH_SIZE); 175 buf_putstring(sigbuf, ses.session_id, SHA1_HASH_SIZE);
176 buf_putbytes(sigbuf, ses.writepayload->data, ses.writepayload->len); 176 buf_putbytes(sigbuf, ses.writepayload->data, ses.writepayload->len);
177 buf_put_sign(ses.writepayload, key, type, sigbuf->data, sigbuf->len); 177 cli_buf_put_sign(ses.writepayload, key, type, sigbuf->data, sigbuf->len);
178 buf_free(sigbuf); /* Nothing confidential in the buffer */ 178 buf_free(sigbuf); /* Nothing confidential in the buffer */
179 } 179 }
180 180
181 encrypt_packet(); 181 encrypt_packet();
182 TRACE(("leave send_msg_userauth_pubkey")) 182 TRACE(("leave send_msg_userauth_pubkey"))
200 send_msg_userauth_pubkey(key, key->type, 0); 200 send_msg_userauth_pubkey(key, key->type, 0);
201 cli_ses.lastprivkey = key; 201 cli_ses.lastprivkey = key;
202 TRACE(("leave cli_auth_pubkey-success")) 202 TRACE(("leave cli_auth_pubkey-success"))
203 return 1; 203 return 1;
204 } else { 204 } else {
205 /* no more keys left */
205 TRACE(("leave cli_auth_pubkey-failure")) 206 TRACE(("leave cli_auth_pubkey-failure"))
206 return 0; 207 return 0;
207 } 208 }
208 } 209 }
210
211 void cli_auth_pubkey_cleanup() {
212
213 #ifdef ENABLE_CLI_AGENTFWD
214 m_close(cli_opts.agent_fd);
215 cli_opts.agent_fd = -1;
216 #endif
217
218 while (cli_opts.privkeys->first) {
219 sign_key * key = list_remove(cli_opts.privkeys->first);
220 sign_key_free(key);
221 }
222 }
209 #endif /* Pubkey auth */ 223 #endif /* Pubkey auth */