- 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@
diff --git a/ChangeLog b/ChangeLog
index 46729e7..8345586 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,10 @@
      These options have been in use for some years;
      ok markus@ "no objection" millert@
      (NB. RCD ID sync only for portable)
+   - 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@
 
 20070927
  - (dtucker) [configure.ac atomicio.c] Fall back to including <sys/poll.h> if
@@ -3287,4 +3291,4 @@
    OpenServer 6 and add osr5bigcrypt support so when someone migrates
    passwords between UnixWare and OpenServer they will still work. OK dtucker@
 
-$Id: ChangeLog,v 1.4763 2007/10/26 04:25:12 djm Exp $
+$Id: ChangeLog,v 1.4764 2007/10/26 04:25:31 djm Exp $
diff --git a/ssh-agent.c b/ssh-agent.c
index fb12545..f179483 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.156 2007/09/09 11:38:01 sobrado Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.157 2007/09/25 23:48:57 canacar Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -457,6 +457,7 @@
 process_add_identity(SocketEntry *e, int version)
 {
 	Idtab *tab = idtab_lookup(version);
+	Identity *id;
 	int type, success = 0, death = 0, confirm = 0;
 	char *type_name, *comment;
 	Key *k = NULL;
@@ -539,19 +540,19 @@
 	}
 	if (lifetime && !death)
 		death = time(NULL) + lifetime;
-	if (lookup_identity(k, version) == NULL) {
-		Identity *id = xmalloc(sizeof(Identity));
+	if ((id = lookup_identity(k, version)) == NULL) {
+		id = xmalloc(sizeof(Identity));
 		id->key = k;
-		id->comment = comment;
-		id->death = death;
-		id->confirm = confirm;
 		TAILQ_INSERT_TAIL(&tab->idlist, id, next);
 		/* Increment the number of identities. */
 		tab->nentries++;
 	} else {
 		key_free(k);
-		xfree(comment);
+		xfree(id->comment);
 	}
+	id->comment = comment;
+	id->death = death;
+	id->confirm = confirm;
 send:
 	buffer_put_int(&e->output, 1);
 	buffer_put_char(&e->output,