[svn] GnuPG - r5044 - trunk/agent
svn author wk
cvs at cvs.gnupg.org
Wed Jun 17 12:19:50 CEST 2009
Author: wk
Date: 2009-06-17 12:19:50 +0200 (Wed, 17 Jun 2009)
New Revision: 5044
Modified:
trunk/agent/ChangeLog
trunk/agent/agent.h
trunk/agent/call-pinentry.c
trunk/agent/command.c
trunk/agent/divert-scd.c
trunk/agent/findkey.c
trunk/agent/genkey.c
trunk/agent/trustlist.c
Log:
Use cancel button in confirmation only if requested.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/ChangeLog 2009-06-17 10:19:50 UTC (rev 5044)
@@ -1,3 +1,9 @@
+2009-06-17 Werner Koch <wk at g10code.com>
+
+ * call-pinentry.c (agent_get_confirmation): Add arg WITH_CANCEL.
+ Change all callers.
+ * trustlist.c (agent_marktrusted): Use WITH_CANCEL
+
2009-06-09 Werner Koch <wk at g10code.com>
* learncard.c (send_cert_back): Ignore certain error codes.
Modified: trunk/agent/agent.h
===================================================================
--- trunk/agent/agent.h 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/agent.h 2009-06-17 10:19:50 UTC (rev 5044)
@@ -256,7 +256,7 @@
const char *desc, const char *prompt,
const char *errtext, int with_qualitybar);
int agent_get_confirmation (ctrl_t ctrl, const char *desc, const char *ok,
- const char *cancel);
+ const char *notokay, int with_cancel);
int agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn);
int agent_popup_message_start (ctrl_t ctrl,
const char *desc, const char *ok_btn);
Modified: trunk/agent/call-pinentry.c
===================================================================
--- trunk/agent/call-pinentry.c 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/call-pinentry.c 2009-06-17 10:19:50 UTC (rev 5044)
@@ -850,10 +850,14 @@
/* 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 user
confirmed it, GPG_ERR_NOT_CONFIRMED for what the text says or an
- other error. */
+ other error. If WITH_CANCEL it true an extra cancel button is
+ displayed to allow the user to easily return a GPG_ERR_CANCELED.
+ if the Pinentry does not support this, the user can still cancel by
+ closing the Pinentry window. */
int
agent_get_confirmation (ctrl_t ctrl,
- const char *desc, const char *ok, const char *cancel)
+ const char *desc, const char *ok,
+ const char *notok, int with_cancel)
{
int rc;
char line[ASSUAN_LINELENGTH];
@@ -881,26 +885,39 @@
{
snprintf (line, DIM(line)-1, "SETOK %s", ok);
line[DIM(line)-1] = 0;
- rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+ rc = assuan_transact (entry_ctx,
+ line, NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
return unlock_pinentry (rc);
}
- if (cancel)
+ if (notok)
{
- snprintf (line, DIM(line)-1, "SETNOTOK %s", cancel);
- line[DIM(line)-1] = 0;
- rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+ /* Try to use the newer NOTOK feature if a cancel button is
+ requested. If no cacnel button is requested we keep on using
+ the standard cancel. */
+ if (with_cancel)
+ {
+ snprintf (line, DIM(line)-1, "SETNOTOK %s", notok);
+ line[DIM(line)-1] = 0;
+ rc = assuan_transact (entry_ctx,
+ line, NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+ else
+ rc = GPG_ERR_ASS_UNKNOWN_CMD;
+
if (gpg_err_code (rc) == GPG_ERR_ASS_UNKNOWN_CMD)
{
- snprintf (line, DIM(line)-1, "SETCANCEL %s", cancel);
+ snprintf (line, DIM(line)-1, "SETCANCEL %s", notok);
line[DIM(line)-1] = 0;
- rc = assuan_transact (entry_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+ rc = assuan_transact (entry_ctx, line,
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
if (rc)
return unlock_pinentry (rc);
}
- rc = assuan_transact (entry_ctx, "CONFIRM", NULL, NULL, NULL, NULL, NULL, NULL);
+ rc = assuan_transact (entry_ctx, "CONFIRM",
+ NULL, NULL, NULL, NULL, NULL, NULL);
if (rc && gpg_err_source (rc) && gpg_err_code (rc) == GPG_ERR_ASS_CANCELED)
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
Modified: trunk/agent/command.c
===================================================================
--- trunk/agent/command.c 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/command.c 2009-06-17 10:19:50 UTC (rev 5044)
@@ -1229,7 +1229,7 @@
if (desc)
plus_to_blank (desc);
- rc = agent_get_confirmation (ctrl, desc, NULL, NULL);
+ rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0);
if (rc)
log_error ("command get_confirmation failed: %s\n", gpg_strerror (rc));
return rc;
Modified: trunk/agent/divert-scd.c
===================================================================
--- trunk/agent/divert-scd.c 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/divert-scd.c 2009-06-17 10:19:50 UTC (rev 5044)
@@ -97,7 +97,7 @@
}
else
{
- rc = agent_get_confirmation (ctrl, desc, NULL, NULL);
+ rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0);
xfree (desc);
}
}
Modified: trunk/agent/findkey.c
===================================================================
--- trunk/agent/findkey.c 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/findkey.c 2009-06-17 10:19:50 UTC (rev 5044)
@@ -183,7 +183,7 @@
if (opt.enforce_passphrase_constraints)
{
err = agent_get_confirmation (arg->ctrl, desc,
- _("Change passphrase"), NULL);
+ _("Change passphrase"), NULL, 0);
if (!err)
arg->change_required = 1;
}
@@ -191,7 +191,7 @@
{
err = agent_get_confirmation (arg->ctrl, desc,
_("Change passphrase"),
- _("I'll change it later"));
+ _("I'll change it later"), 0);
if (!err)
arg->change_required = 1;
else if (gpg_err_code (err) == GPG_ERR_CANCELED)
Modified: trunk/agent/genkey.c
===================================================================
--- trunk/agent/genkey.c 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/genkey.c 2009-06-17 10:19:50 UTC (rev 5044)
@@ -156,7 +156,7 @@
}
else
err = agent_get_confirmation (ctrl, desc,
- anyway_btn, _("Enter new passphrase"));
+ anyway_btn, _("Enter new passphrase"), 0);
return err;
}
Modified: trunk/agent/trustlist.c
===================================================================
--- trunk/agent/trustlist.c 2009-06-17 09:45:50 UTC (rev 5043)
+++ trunk/agent/trustlist.c 2009-06-17 10:19:50 UTC (rev 5044)
@@ -616,7 +616,7 @@
xfree (nameformatted);
return out_of_core ();
}
- err = agent_get_confirmation (ctrl, desc, _("Yes"), _("No"));
+ err = agent_get_confirmation (ctrl, desc, _("Yes"), _("No"), 1);
xfree (desc);
if (!err)
yes_i_trust = 1;
@@ -664,7 +664,7 @@
/* TRANSLATORS: "Correct" is the label of a button and intended
to be hit if the fingerprint matches the one of the CA. The
other button is "the default "Cancel" of the Pinentry. */
- err = agent_get_confirmation (ctrl, desc, _("Correct"), _("Wrong"));
+ err = agent_get_confirmation (ctrl, desc, _("Correct"), _("Wrong"), 1);
xfree (desc);
if (gpg_err_code (err) == GPG_ERR_NOT_CONFIRMED)
yes_i_trust = 0;
More information about the Gnupg-commits
mailing list