diff options
author | Werner Koch <[email protected]> | 2002-02-18 20:44:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2002-02-18 20:44:48 +0000 |
commit | 822e682c50764d1efffd2446f8fa2e7c2ef7bb17 (patch) | |
tree | 6292f50300464f6f3fa20b253918182864694b3f /agent/query.c | |
parent | * fopencookie.c: Dummy function. (diff) | |
download | gnupg-822e682c50764d1efffd2446f8fa2e7c2ef7bb17.tar.gz gnupg-822e682c50764d1efffd2446f8fa2e7c2ef7bb17.zip |
* command.c (cmd_marktrusted): Implemented.
* trustlist.c (agent_marktrusted): New.
(open_list): Add APPEND arg.
* query.c (agent_get_confirmation): New.
Diffstat (limited to 'agent/query.c')
-rw-r--r-- | agent/query.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/agent/query.c b/agent/query.c index 3b8cd08df..1abfefcd9 100644 --- a/agent/query.c +++ b/agent/query.c @@ -297,6 +297,42 @@ agent_get_passphrase (char **retpass, const char *desc, const char *prompt, } + +/* Pop up the PIN-entry, display the text and the prompt and ask the + user to confirm this. We return 0 for success, ie. the used + confirmed it, GNUPG_Not_Confirmed for what the text says or an + other error. */ +int +agent_get_confirmation (const char *desc, const char *prompt) +{ + int rc; + char line[ASSUAN_LINELENGTH]; + + rc = start_pinentry (); + if (rc) + return rc; + + if (desc) + snprintf (line, DIM(line)-1, "SETDESC %s", desc); + else + snprintf (line, DIM(line)-1, "RESET"); + line[DIM(line)-1] = 0; + rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL); + if (rc) + return map_assuan_err (rc); + + if (prompt) + { + snprintf (line, DIM(line)-1, "SETPROMPT %s", prompt); + line[DIM(line)-1] = 0; + rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL); + if (rc) + return map_assuan_err (rc); + } + + rc = assuan_transact (entry_ctx, "CONFIRM", NULL, NULL, NULL, NULL); + return map_assuan_err (rc); +} |