diff options
Diffstat (limited to 'ssh-agent.c')
-rw-r--r-- | ssh-agent.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ssh-agent.c b/ssh-agent.c index f5f87cca3..6f89dd5ca 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.39 2000/11/12 19:50:38 markus Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.40 2000/11/14 23:48:55 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: ssh-agent.c,v 1.39 2000/11/12 19:50:38 markus Exp $"); | 40 | RCSID("$OpenBSD: ssh-agent.c,v 1.40 2000/11/14 23:48:55 markus Exp $"); |
41 | 41 | ||
42 | #include "ssh.h" | 42 | #include "ssh.h" |
43 | #include "rsa.h" | 43 | #include "rsa.h" |
@@ -308,8 +308,9 @@ process_remove_identity(SocketEntry *e, int version) | |||
308 | /* | 308 | /* |
309 | * We have this key. Free the old key. Since we | 309 | * We have this key. Free the old key. Since we |
310 | * don\'t want to leave empty slots in the middle of | 310 | * don\'t want to leave empty slots in the middle of |
311 | * the array, we actually free the key there and copy | 311 | * the array, we actually free the key there and move |
312 | * data from the last entry. | 312 | * all the entries between the empty slot and the end |
313 | * of the array. | ||
313 | */ | 314 | */ |
314 | Idtab *tab = idtab_lookup(version); | 315 | Idtab *tab = idtab_lookup(version); |
315 | key_free(tab->identities[idx].key); | 316 | key_free(tab->identities[idx].key); |
@@ -318,8 +319,13 @@ process_remove_identity(SocketEntry *e, int version) | |||
318 | fatal("process_remove_identity: " | 319 | fatal("process_remove_identity: " |
319 | "internal error: tab->nentries %d", | 320 | "internal error: tab->nentries %d", |
320 | tab->nentries); | 321 | tab->nentries); |
321 | if (idx != tab->nentries - 1) | 322 | if (idx != tab->nentries - 1) { |
322 | tab->identities[idx] = tab->identities[tab->nentries - 1]; | 323 | int i; |
324 | for (i = idx; i < tab->nentries - 1; i++) | ||
325 | tab->identities[i] = tab->identities[i+1]; | ||
326 | } | ||
327 | tab->identities[tab->nentries - 1].key = NULL; | ||
328 | tab->identities[tab->nentries - 1].comment = NULL; | ||
323 | tab->nentries--; | 329 | tab->nentries--; |
324 | success = 1; | 330 | success = 1; |
325 | } | 331 | } |