[git] GnuPG - branch, scd-pin-prompt, updated. gnupg-2.1.0beta3-18-gb5aa197
by Ben Kibbey
cvs at cvs.gnupg.org
Tue Jan 24 04:10:29 CET 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, scd-pin-prompt has been updated
via b5aa197a5f8d3ad6c484f8cc19e0b4513573a9a3 (commit)
from 633ea8531e4c12164f481d093936f3a9054d8ad9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b5aa197a5f8d3ad6c484f8cc19e0b4513573a9a3
Author: Ben Kibbey <bjk at luxsci.net>
Date: Mon Jan 23 20:27:14 2012 -0500
Set both the app and default SCD pin prompt at the same time.
Fixes the case when scdaemon prompts for card insertion.
* scd/app-openpgp.c (do_set_pin_prompt): Fix indentation. No longer
unset the prompt with '-' since the OPTION command without a value
does this anyway.
* scd/app.c (expand_pin_prompt): Fix indentation.
* scd/command.c (set_pinentry_prompt): Set both the default and
application prompt when available.
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index ea3e52e..a5e9807 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -3765,14 +3765,14 @@ do_set_pin_prompt(app_t app, int which, const char *prompt)
switch (which)
{
- case PIN_SIGN_PROMPT:
- p = &app->app_local->pin_prompt;
- break;
- case PIN_ADMIN_PROMPT:
- p = &app->app_local->pin_admin_prompt;
+ case PIN_SIGN_PROMPT:
+ p = &app->app_local->pin_prompt;
+ break;
+ case PIN_ADMIN_PROMPT:
+ p = &app->app_local->pin_admin_prompt;
+ break;
+ default:
break;
- default:
- break;
}
if (p)
@@ -3780,7 +3780,7 @@ do_set_pin_prompt(app_t app, int which, const char *prompt)
xfree (*p);
*p = NULL;
- if (prompt && *prompt != '-' && *(prompt+1) != 0)
+ if (prompt && *prompt)
{
*p = xtrystrdup (prompt);
if (!*p)
diff --git a/scd/app.c b/scd/app.c
index e0b2fe6..51bd207 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -969,20 +969,20 @@ expand_pin_prompt(const char *prompt, const char *prepend, int which, ...)
switch (which)
{
- /* Signature count. */
- case PIN_SIGN_PROMPT:
- luval = va_arg (ap, unsigned long);
- snprintf (valuebuf, sizeof (valuebuf), "%lu", luval);
- token = "|S|";
- break;
- /* Pin tries remaining. */
- case PIN_ADMIN_PROMPT:
- intval = va_arg (ap, int);
- snprintf (valuebuf, sizeof (valuebuf), "%i", intval);
- token = "|A|";
- break;
- default:
- break;
+ /* Signature count. */
+ case PIN_SIGN_PROMPT:
+ luval = va_arg (ap, unsigned long);
+ snprintf (valuebuf, sizeof (valuebuf), "%lu", luval);
+ token = "|S|";
+ break;
+ /* Pin tries remaining. */
+ case PIN_ADMIN_PROMPT:
+ intval = va_arg (ap, int);
+ snprintf (valuebuf, sizeof (valuebuf), "%i", intval);
+ token = "|A|";
+ break;
+ default:
+ break;
}
va_end (ap);
diff --git a/scd/command.c b/scd/command.c
index 2704e57..7b7536b 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -395,9 +395,10 @@ reset_notify (assuan_context_t ctx, char *line)
}
static gpg_error_t
-set_pinentry_prompt(struct server_local_s *srv, int which, const char *prompt)
+set_pinentry_prompt(ctrl_t ctrl, int which, const char *prompt)
{
gpg_error_t rc = 0;
+ struct server_local_s *srv = ctrl->server_local;
char **p = NULL;
switch (which)
@@ -417,7 +418,7 @@ set_pinentry_prompt(struct server_local_s *srv, int which, const char *prompt)
xfree (*p);
*p = NULL;
- if (prompt && *prompt != '-' && *(prompt+1) != 0)
+ if (prompt && *prompt)
{
*p = xtrystrdup (prompt);
if (!*p)
@@ -425,6 +426,9 @@ set_pinentry_prompt(struct server_local_s *srv, int which, const char *prompt)
}
}
+ if (!rc && ctrl->app_ctx)
+ rc = app_set_pin_prompt (ctrl->app_ctx, PIN_SIGN_PROMPT, prompt);
+
return rc;
}
@@ -451,17 +455,11 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
* app.c:expand_pin_prompt() for details. */
else if (!strcmp (key, "pin-prompt"))
{
- if (ctrl->app_ctx)
- return app_set_pin_prompt (ctrl->app_ctx, PIN_SIGN_PROMPT, value);
- else
- return set_pinentry_prompt (ctrl->server_local, PIN_SIGN_PROMPT, value);
+ return set_pinentry_prompt (ctrl, PIN_SIGN_PROMPT, value);
}
else if (!strcmp (key, "pin-admin-prompt"))
{
- if (ctrl->app_ctx)
- return app_set_pin_prompt (ctrl->app_ctx, PIN_ADMIN_PROMPT, value);
- else
- return set_pinentry_prompt (ctrl->server_local, PIN_ADMIN_PROMPT, value);
+ return set_pinentry_prompt (ctrl, PIN_ADMIN_PROMPT, value);
}
return 0;
-----------------------------------------------------------------------
Summary of changes:
scd/app-openpgp.c | 16 ++++++++--------
scd/app.c | 28 ++++++++++++++--------------
scd/command.c | 18 ++++++++----------
3 files changed, 30 insertions(+), 32 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list