mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
gpg: Do not delete any keys if --dry-run is passed.
* g10/delkey.c (do_delete_key): Don't delete the keyblock on dry runs. Do not clear the ownertrust. Do not let the agent delete the key. -- Co-authored-by: Matheus Afonso Martins Moreira Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
1702179d91
commit
5c46c5f745
@ -190,7 +190,7 @@ do_delete_key (ctrl_t ctrl, const char *username, int secret, int force,
|
||||
* pre-caution is that since 2.1 the secret key may also
|
||||
* be used for other protocols and thus deleting it from
|
||||
* the gpg would also delete the key for other tools. */
|
||||
if (!err)
|
||||
if (!err && !opt.dry_run)
|
||||
err = agent_delete_key (NULL, hexgrip, prompt,
|
||||
opt.answer_yes);
|
||||
xfree (prompt);
|
||||
@ -221,7 +221,7 @@ do_delete_key (ctrl_t ctrl, const char *username, int secret, int force,
|
||||
}
|
||||
else
|
||||
{
|
||||
err = keydb_delete_keyblock (hd);
|
||||
err = opt.dry_run? 0 : keydb_delete_keyblock (hd);
|
||||
if (err)
|
||||
{
|
||||
log_error (_("deleting keyblock failed: %s\n"),
|
||||
@ -234,7 +234,7 @@ do_delete_key (ctrl_t ctrl, const char *username, int secret, int force,
|
||||
revalidation_mark(). This makes sense - only deleting keys
|
||||
that have ownertrust set should trigger this. */
|
||||
|
||||
if (!secret && pk && clear_ownertrusts (ctrl, pk))
|
||||
if (!secret && pk && !opt.dry_run && clear_ownertrusts (ctrl, pk))
|
||||
{
|
||||
if (opt.verbose)
|
||||
log_info (_("ownertrust information cleared\n"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user