diff options
author | Werner Koch <wk@gnupg.org> | 2014-09-18 16:00:34 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-09-20 16:27:16 +0200 |
commit | 1d33d03f0bb576601f5eef1a548cbc519f251b17 (patch) | |
tree | ec042f5f3122281db597a5ddd9a9007d6207bfb6 | |
parent | gpg: Make algorithm selection prompt for ECC more clear. (diff) | |
download | gnupg2-1d33d03f0bb576601f5eef1a548cbc519f251b17.tar.xz gnupg2-1d33d03f0bb576601f5eef1a548cbc519f251b17.zip |
gpg: --delete-secret-key - check that a secret key exists.
* g10/delkey.c (do_delete_key): Check availibility of a secret key.
--
Actually we check that at least one secret subkey exists.
-rw-r--r-- | g10/delkey.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/g10/delkey.c b/g10/delkey.c index 3de705dfa..063de78e6 100644 --- a/g10/delkey.c +++ b/g10/delkey.c @@ -111,6 +111,15 @@ do_delete_key( const char *username, int secret, int force, int *r_sec_avail ) err = 0; } + if (secret && !have_secret_key_with_kid (keyid)) + { + err = gpg_error (GPG_ERR_NOT_FOUND); + log_error (_("key \"%s\" not found: %s\n"), username, gpg_strerror (err)); + write_status_text (STATUS_DELETE_PROBLEM, "1"); + goto leave; + } + + if (opt.batch && exactmatch) okay++; else if (opt.batch && secret) |