From 74fe0b79a1dc50a810b23100aa10284e792cc3e5 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Tue, 24 Jan 2012 18:52:02 -0500 Subject: [PATCH] Let the RESTART command reset any scdaemon pin prompts. The gpg-agent sends the RESTART command to scdaemon when the client has disconnected. This commit allows future connections to scdaemon use the default pinentry prompts. It is recommended to use the scdaemon LOCK command to prevent other scdaemon clients from altering the prompts before the current client has finished with the scdaemon pinentry since the set prompts are global to the application. * scd/command.c (cmd_restart): Free any allocated custom pinentry prompt strings to let the application use its default. --- scd/command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scd/command.c b/scd/command.c index 0b82a2b37..d85f0fcdf 100644 --- a/scd/command.c +++ b/scd/command.c @@ -142,7 +142,7 @@ struct server_local_s /* User-defined pinentry prompt strings. Needed both here and in the app * since they may be set by the user before an app is selected with * select_application(). They are copied to the app when - * select_application() succeeds and further modifications done in the app. + * select_application() succeeds. * */ char *pin_prompt; char *pin_admin_prompt; @@ -1838,6 +1838,11 @@ cmd_restart (assuan_context_t ctx, char *line) locked_session = NULL; log_info ("implicitly unlocking due to RESTART\n"); } + + xfree (ctrl->server_local->pin_prompt); + xfree (ctrl->server_local->pin_admin_prompt); + ctrl->server_local->pin_prompt = NULL; + ctrl->server_local->pin_admin_prompt = NULL; return 0; }