diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-02-09 16:00:49 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-02-09 16:00:49 +0900 |
commit | e44fd53e752fcce7add5c9edf81fd854e1560ad6 (patch) | |
tree | 1671eb98c13681076d18e2856b7a4ee100dc8e56 /g10/delkey.c | |
parent | d1ee8399f075bff2b90a58f59fce00a3887feb26 (diff) | |
download | gpg2-e44fd53e752fcce7add5c9edf81fd854e1560ad6.tar.gz gpg2-e44fd53e752fcce7add5c9edf81fd854e1560ad6.tar.bz2 gpg2-e44fd53e752fcce7add5c9edf81fd854e1560ad6.zip |
Imported Upstream version 2.2.18upstream/2.2.18
Diffstat (limited to 'g10/delkey.c')
-rw-r--r-- | g10/delkey.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/g10/delkey.c b/g10/delkey.c index e91acb0..6116d74 100644 --- a/g10/delkey.c +++ b/g10/delkey.c @@ -281,25 +281,16 @@ do_delete_key (ctrl_t ctrl, const char *username, int secret, int force, } else if (thiskeyonly == 2) { - int selected = 0; - /* Delete the specified public subkey. */ for (kbctx=NULL; (node = walk_kbnode (keyblock, &kbctx, 0)); ) - { - if (thiskeyonly && targetnode != node) - continue; + if (targetnode == node) + break; + log_assert (node); + delete_kbnode (node); + while ((node = walk_kbnode (keyblock, &kbctx, 0)) + && node->pkt->pkttype == PKT_SIGNATURE) + delete_kbnode (node); - if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY) - { - selected = targetnode == node; - if (selected) - delete_kbnode (node); - } - else if (selected && node->pkt->pkttype == PKT_SIGNATURE) - delete_kbnode (node); - else - selected = 0; - } commit_kbnode (&keyblock); err = keydb_update_keyblock (ctrl, hd, keyblock); if (err) |