summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2007-10-26 14:25:31 +1000
committerDamien Miller <djm@mindrot.org>2007-10-26 14:25:31 +1000
commit4c7728c651254eb05a8c3ffbcc25632b7c80e722 (patch)
tree0b8a1dac10bdd24f2d26883952d90f7fe51bf6d1 /ssh-agent.c
parent733124b5dd735cdd12be7dd7002a22f5d3896e29 (diff)
- canacar@cvs.openbsd.org 2007/09/25 23:48:57
[ssh-agent.c] When adding a key that already exists, update the properties (time, confirm, comment) instead of discarding them. ok djm@ markus@
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index fb12545b0..f17948349 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.156 2007/09/09 11:38:01 sobrado Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.157 2007/09/25 23:48:57 canacar 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
@@ -457,6 +457,7 @@ static void
457process_add_identity(SocketEntry *e, int version) 457process_add_identity(SocketEntry *e, int version)
458{ 458{
459 Idtab *tab = idtab_lookup(version); 459 Idtab *tab = idtab_lookup(version);
460 Identity *id;
460 int type, success = 0, death = 0, confirm = 0; 461 int type, success = 0, death = 0, confirm = 0;
461 char *type_name, *comment; 462 char *type_name, *comment;
462 Key *k = NULL; 463 Key *k = NULL;
@@ -539,19 +540,19 @@ process_add_identity(SocketEntry *e, int version)
539 } 540 }
540 if (lifetime && !death) 541 if (lifetime && !death)
541 death = time(NULL) + lifetime; 542 death = time(NULL) + lifetime;
542 if (lookup_identity(k, version) == NULL) { 543 if ((id = lookup_identity(k, version)) == NULL) {
543 Identity *id = xmalloc(sizeof(Identity)); 544 id = xmalloc(sizeof(Identity));
544 id->key = k; 545 id->key = k;
545 id->comment = comment;
546 id->death = death;
547 id->confirm = confirm;
548 TAILQ_INSERT_TAIL(&tab->idlist, id, next); 546 TAILQ_INSERT_TAIL(&tab->idlist, id, next);
549 /* Increment the number of identities. */ 547 /* Increment the number of identities. */
550 tab->nentries++; 548 tab->nentries++;
551 } else { 549 } else {
552 key_free(k); 550 key_free(k);
553 xfree(comment); 551 xfree(id->comment);
554 } 552 }
553 id->comment = comment;
554 id->death = death;
555 id->confirm = confirm;
555send: 556send:
556 buffer_put_int(&e->output, 1); 557 buffer_put_int(&e->output, 1);
557 buffer_put_char(&e->output, 558 buffer_put_char(&e->output,