mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01: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
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user