mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Allow unattended deletion of secret keys.
* agent/command.c (cmd_delete_key): Make the --force option depend on --disallow-loopback-passphrase. * g10/call-agent.c (agent_delete_key): Add arg FORCE. * g10/delkey.c (do_delete_key): Pass opt.answer_yes to agent_delete_key. -- Unless the agent has been configured with --disallow-loopback-passpharse an unattended deletion of a secret key is now possible with gpg by using --batch _and_ --yes. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
693838f012
commit
ac9ff644b1
6 changed files with 45 additions and 10 deletions
|
@ -2349,9 +2349,11 @@ agent_export_key (ctrl_t ctrl, const char *hexkeygrip, const char *desc,
|
|||
|
||||
/* Ask the agent to delete the key identified by HEXKEYGRIP. If DESC
|
||||
is not NULL, display DESC instead of the default description
|
||||
message. */
|
||||
message. If FORCE is true the agent is advised not to ask for
|
||||
confirmation. */
|
||||
gpg_error_t
|
||||
agent_delete_key (ctrl_t ctrl, const char *hexkeygrip, const char *desc)
|
||||
agent_delete_key (ctrl_t ctrl, const char *hexkeygrip, const char *desc,
|
||||
int force)
|
||||
{
|
||||
gpg_error_t err;
|
||||
char line[ASSUAN_LINELENGTH];
|
||||
|
@ -2376,7 +2378,8 @@ agent_delete_key (ctrl_t ctrl, const char *hexkeygrip, const char *desc)
|
|||
return err;
|
||||
}
|
||||
|
||||
snprintf (line, DIM(line)-1, "DELETE_KEY %s", hexkeygrip);
|
||||
snprintf (line, DIM(line)-1, "DELETE_KEY%s %s",
|
||||
force? " --force":"", hexkeygrip);
|
||||
err = assuan_transact (agent_ctx, line, NULL, NULL,
|
||||
default_inq_cb, &dfltparm,
|
||||
NULL, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue