diff options
| author | NIIBE Yutaka <[email protected]> | 2019-06-04 00:17:21 +0000 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2019-06-04 00:17:21 +0000 |
| commit | 20acc7c0226550530085a674ef1bb41ebfa39408 (patch) | |
| tree | b459b077352be56c64262645039a04f213139ce7 /agent/command.c | |
| parent | doc: Add a section for gpg-check-pattern. (diff) | |
| download | gnupg-20acc7c0226550530085a674ef1bb41ebfa39408.tar.gz gnupg-20acc7c0226550530085a674ef1bb41ebfa39408.zip | |
g10,agent: Support CONFIRM for --delete-key.
* agent/call-pinentry.c (agent_get_confirmation): Add call of
pinentry_loopback_confirm.
(agent_popup_message_start): Likewise.
(agent_popup_message_stop): Return if it's loopback mode.
* agent/command.c (pinentry_loopback_confirm): New.
* g10/call-agent.c (default_inq_cb): Support "CONFIRM" inquery
when PINENTRY_MODE_LOOPBACK mode.
(confirm_status_cb): New.
(agent_delete_key): Supply confirm_status_cb to set the description
string for confirmation.
--
In the Assuan communication, we introduce new interaction:
[gpg] [gpg-agent]
--- CMD: PKDECRYPT -->
<-- STATUS: SETDESC "..."
<-- STATUS: SETOK "..."
<-- STATUS: SETNOTOK "..."
<-- INQUERY: CONFIRM 0/1 (0 for display, 1 for user query)
--- INQUERY-result: -->
<-- RESULT: ...
GnuPG-bug-id: 3465
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/command.c')
| -rw-r--r-- | agent/command.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/agent/command.c b/agent/command.c index 3c2da183c..b59532ce5 100644 --- a/agent/command.c +++ b/agent/command.c @@ -3680,3 +3680,26 @@ pinentry_loopback(ctrl_t ctrl, const char *keyword, assuan_end_confidential (ctx); return rc; } + +/* Helper for the pinentry loopback mode to ask confirmation + or just to show message. */ +gpg_error_t +pinentry_loopback_confirm (ctrl_t ctrl, const char *desc, + int ask_confirmation, + const char *ok, const char *notok) +{ + gpg_error_t err = 0; + assuan_context_t ctx = ctrl->server_local->assuan_ctx; + + if (desc) + err = print_assuan_status (ctx, "SETDESC", "%s", desc); + if (!err && ok) + err = print_assuan_status (ctx, "SETOK", "%s", ok); + if (!err && notok) + err = print_assuan_status (ctx, "SETNOTOK", "%s", notok); + + if (!err) + err = assuan_inquire (ctx, ask_confirmation ? "CONFIRM 1" : "CONFIRM 0", + NULL, NULL, 0); + return err; +} |
