1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

agent: Add option --force to the DELETE_KEY command.

* agent/findkey.c (agent_delete_key): Add arg "force".
* agent/command.c (cmd_delete_key): Add option --force.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-08-07 12:55:29 +02:00
parent 9f31ab3d21
commit a68c5c5c7f
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 58 additions and 52 deletions

View file

@ -2388,27 +2388,29 @@ cmd_export_key (assuan_context_t ctx, char *line)
static const char hlp_delete_key[] =
"DELETE_KEY <hexstring_with_keygrip>\n"
"DELETE_KEY [--force] <hexstring_with_keygrip>\n"
"\n"
"Delete a secret key from the key store.\n"
"As safeguard the agent asks the user for confirmation.\n";
"Unless --force is used the agent asks the user for confirmation.\n";
static gpg_error_t
cmd_delete_key (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
gpg_error_t err;
int force;
unsigned char grip[20];
if (ctrl->restricted)
return leave_cmd (ctx, gpg_error (GPG_ERR_FORBIDDEN));
force = has_option (line, "--force");
line = skip_options (line);
err = parse_keygrip (ctx, line, grip);
if (err)
goto leave;
err = agent_delete_key (ctrl, ctrl->server_local->keydesc, grip);
err = agent_delete_key (ctrl, ctrl->server_local->keydesc, grip, force );
if (err)
goto leave;