summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index 6788287b7..cc3bffad8 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.219 2017/04/30 23:10:43 djm Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.220 2017/04/30 23:18:44 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -247,6 +247,8 @@ process_request_identities(SocketEntry *e, int version)
247 Identity *id; 247 Identity *id;
248 struct sshbuf *msg; 248 struct sshbuf *msg;
249 int r; 249 int r;
250 u_char *blob;
251 size_t blen;
250 252
251 if ((msg = sshbuf_new()) == NULL) 253 if ((msg = sshbuf_new()) == NULL)
252 fatal("%s: sshbuf_new failed", __func__); 254 fatal("%s: sshbuf_new failed", __func__);
@@ -256,21 +258,15 @@ process_request_identities(SocketEntry *e, int version)
256 (r = sshbuf_put_u32(msg, tab->nentries)) != 0) 258 (r = sshbuf_put_u32(msg, tab->nentries)) != 0)
257 fatal("%s: buffer error: %s", __func__, ssh_err(r)); 259 fatal("%s: buffer error: %s", __func__, ssh_err(r));
258 TAILQ_FOREACH(id, &tab->idlist, next) { 260 TAILQ_FOREACH(id, &tab->idlist, next) {
259 if (id->key->type == KEY_RSA1) { 261 if ((r = sshkey_to_blob(id->key, &blob, &blen)) != 0) {
260 } else { 262 error("%s: sshkey_to_blob: %s", __func__,
261 u_char *blob; 263 ssh_err(r));
262 size_t blen; 264 continue;
263
264 if ((r = sshkey_to_blob(id->key, &blob, &blen)) != 0) {
265 error("%s: sshkey_to_blob: %s", __func__,
266 ssh_err(r));
267 continue;
268 }
269 if ((r = sshbuf_put_string(msg, blob, blen)) != 0)
270 fatal("%s: buffer error: %s",
271 __func__, ssh_err(r));
272 free(blob);
273 } 265 }
266 if ((r = sshbuf_put_string(msg, blob, blen)) != 0)
267 fatal("%s: buffer error: %s",
268 __func__, ssh_err(r));
269 free(blob);
274 if ((r = sshbuf_put_cstring(msg, id->comment)) != 0) 270 if ((r = sshbuf_put_cstring(msg, id->comment)) != 0)
275 fatal("%s: buffer error: %s", __func__, ssh_err(r)); 271 fatal("%s: buffer error: %s", __func__, ssh_err(r));
276 } 272 }
@@ -639,7 +635,7 @@ process_add_smartcard_key(SocketEntry *e)
639 count = pkcs11_add_provider(canonical_provider, pin, &keys); 635 count = pkcs11_add_provider(canonical_provider, pin, &keys);
640 for (i = 0; i < count; i++) { 636 for (i = 0; i < count; i++) {
641 k = keys[i]; 637 k = keys[i];
642 version = k->type == KEY_RSA1 ? 1 : 2; 638 version = 2;
643 tab = idtab_lookup(version); 639 tab = idtab_lookup(version);
644 if (lookup_identity(k, version) == NULL) { 640 if (lookup_identity(k, version) == NULL) {
645 id = xcalloc(1, sizeof(Identity)); 641 id = xcalloc(1, sizeof(Identity));