diff options
Diffstat (limited to 'sm')
-rw-r--r-- | sm/ChangeLog | 5 | ||||
-rw-r--r-- | sm/delete.c | 19 |
2 files changed, 20 insertions, 4 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog index 518eb2b38..a98ce4d86 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,8 @@ +2009-03-23 Werner Koch <wk@g10code.com> + + * delete.c (delete_one): Also delete ephemeral certificates if + specified uniquely. + 2009-03-20 Werner Koch <wk@g10code.com> * keylist.c (list_internal_keys): Set released cert to NULL. diff --git a/sm/delete.c b/sm/delete.c index 00f602827..fd49ebeab 100644 --- a/sm/delete.c +++ b/sm/delete.c @@ -1,5 +1,5 @@ -/* delete.c - * Copyright (C) 2002 Free Software Foundation, Inc. +/* delete.c - Delete certificates from the keybox. + * Copyright (C) 2002, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -43,6 +43,7 @@ delete_one (ctrl_t ctrl, const char *username) KEYDB_HANDLE kh = NULL; ksba_cert_t cert = NULL; int duplicates = 0; + int is_ephem = 0; rc = keydb_classify_name (username, &desc); if (rc) @@ -60,11 +61,21 @@ delete_one (ctrl_t ctrl, const char *username) goto leave; } - + /* If the key is specified in a unique way, include ephemeral keys + in the search. */ + if ( desc.mode == KEYDB_SEARCH_MODE_FPR + || desc.mode == KEYDB_SEARCH_MODE_FPR20 + || desc.mode == KEYDB_SEARCH_MODE_FPR16 + || desc.mode == KEYDB_SEARCH_MODE_KEYGRIP ) + { + is_ephem = 1; + keydb_set_ephemeral (kh, 1); + } + rc = keydb_search (kh, &desc, 1); if (!rc) rc = keydb_get_cert (kh, &cert); - if (!rc) + if (!rc && !is_ephem) { unsigned char fpr[20]; |