mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
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.
This commit is contained in:
parent
633ea8531e
commit
b5aa197a5f
@ -3765,14 +3765,14 @@ do_set_pin_prompt(app_t app, int which, const char *prompt)
|
|||||||
|
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
case PIN_SIGN_PROMPT:
|
case PIN_SIGN_PROMPT:
|
||||||
p = &app->app_local->pin_prompt;
|
p = &app->app_local->pin_prompt;
|
||||||
|
break;
|
||||||
|
case PIN_ADMIN_PROMPT:
|
||||||
|
p = &app->app_local->pin_admin_prompt;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
case PIN_ADMIN_PROMPT:
|
|
||||||
p = &app->app_local->pin_admin_prompt;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
@ -3780,7 +3780,7 @@ do_set_pin_prompt(app_t app, int which, const char *prompt)
|
|||||||
xfree (*p);
|
xfree (*p);
|
||||||
*p = NULL;
|
*p = NULL;
|
||||||
|
|
||||||
if (prompt && *prompt != '-' && *(prompt+1) != 0)
|
if (prompt && *prompt)
|
||||||
{
|
{
|
||||||
*p = xtrystrdup (prompt);
|
*p = xtrystrdup (prompt);
|
||||||
if (!*p)
|
if (!*p)
|
||||||
|
28
scd/app.c
28
scd/app.c
@ -969,20 +969,20 @@ expand_pin_prompt(const char *prompt, const char *prepend, int which, ...)
|
|||||||
|
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
/* Signature count. */
|
/* Signature count. */
|
||||||
case PIN_SIGN_PROMPT:
|
case PIN_SIGN_PROMPT:
|
||||||
luval = va_arg (ap, unsigned long);
|
luval = va_arg (ap, unsigned long);
|
||||||
snprintf (valuebuf, sizeof (valuebuf), "%lu", luval);
|
snprintf (valuebuf, sizeof (valuebuf), "%lu", luval);
|
||||||
token = "|S|";
|
token = "|S|";
|
||||||
break;
|
break;
|
||||||
/* Pin tries remaining. */
|
/* Pin tries remaining. */
|
||||||
case PIN_ADMIN_PROMPT:
|
case PIN_ADMIN_PROMPT:
|
||||||
intval = va_arg (ap, int);
|
intval = va_arg (ap, int);
|
||||||
snprintf (valuebuf, sizeof (valuebuf), "%i", intval);
|
snprintf (valuebuf, sizeof (valuebuf), "%i", intval);
|
||||||
token = "|A|";
|
token = "|A|";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
@ -395,9 +395,10 @@ reset_notify (assuan_context_t ctx, char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gpg_error_t
|
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;
|
gpg_error_t rc = 0;
|
||||||
|
struct server_local_s *srv = ctrl->server_local;
|
||||||
char **p = NULL;
|
char **p = NULL;
|
||||||
|
|
||||||
switch (which)
|
switch (which)
|
||||||
@ -417,7 +418,7 @@ set_pinentry_prompt(struct server_local_s *srv, int which, const char *prompt)
|
|||||||
xfree (*p);
|
xfree (*p);
|
||||||
*p = NULL;
|
*p = NULL;
|
||||||
|
|
||||||
if (prompt && *prompt != '-' && *(prompt+1) != 0)
|
if (prompt && *prompt)
|
||||||
{
|
{
|
||||||
*p = xtrystrdup (prompt);
|
*p = xtrystrdup (prompt);
|
||||||
if (!*p)
|
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;
|
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. */
|
* app.c:expand_pin_prompt() for details. */
|
||||||
else if (!strcmp (key, "pin-prompt"))
|
else if (!strcmp (key, "pin-prompt"))
|
||||||
{
|
{
|
||||||
if (ctrl->app_ctx)
|
return set_pinentry_prompt (ctrl, PIN_SIGN_PROMPT, value);
|
||||||
return app_set_pin_prompt (ctrl->app_ctx, PIN_SIGN_PROMPT, value);
|
|
||||||
else
|
|
||||||
return set_pinentry_prompt (ctrl->server_local, PIN_SIGN_PROMPT, value);
|
|
||||||
}
|
}
|
||||||
else if (!strcmp (key, "pin-admin-prompt"))
|
else if (!strcmp (key, "pin-admin-prompt"))
|
||||||
{
|
{
|
||||||
if (ctrl->app_ctx)
|
return set_pinentry_prompt (ctrl, PIN_ADMIN_PROMPT, value);
|
||||||
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 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user