diff options
author | Werner Koch <wk@gnupg.org> | 2009-03-23 17:17:49 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2009-03-23 17:17:49 +0100 |
commit | 9828f9be11dbacadf2e8a078e99481f9208bbd72 (patch) | |
tree | 7199bab0dbf61bf2a813b58c1e401239d2e6af37 /sm | |
parent | Fix keygrip computation for TCOS 3 cards. (diff) | |
download | gnupg2-9828f9be11dbacadf2e8a078e99481f9208bbd72.tar.xz gnupg2-9828f9be11dbacadf2e8a078e99481f9208bbd72.zip |
Allow deletion of ephemeral keys.
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]; |