mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
gpg: Also delete key-binding signature when deleting a subkey.
* g10/delkey.c (do_delete_key): Simplify and correct subkey deletion. -- GnuPG-bug-id: 4665, 4457 Fixes-commit: d9b31d3a20b89a5ad7e9a2158b6da63a9a37fa8a Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
2906636b92
commit
d8052db74a
23
g10/delkey.c
23
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user