1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

scd: Fix RESET command handling (more).

* scd/app-common.h (struct app_ctx_s): Add reset_requested.
* scd/app.c (app_reset): Locking APP, set reset_requested.
(deallocate_app): Release the lock.
(release_application): Add LOCKED_ALREADY argument.
(scd_update_reader_status_file): Hold the lock when accessing APP.
When reset_requested is set, close the reader and deallocate APP.
* scd/command.c (open_card_with_request, cmd_restart): Follow the
change of release_application.
(send_client_notifications): Here it calls release_application holding
the lock.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2017-02-17 11:50:40 +09:00
parent 7006352da7
commit 99d4dfe836
3 changed files with 26 additions and 12 deletions

View file

@ -227,7 +227,7 @@ open_card_with_request (ctrl_t ctrl, const char *apptype, const char *serialno)
/* Re-scan USB devices. Release APP, before the scan. */
ctrl->app_ctx = NULL;
release_application (app);
release_application (app, 0);
if (serialno)
serialno_bin = hex_to_buffer (serialno, &serialno_bin_len);
@ -1495,7 +1495,7 @@ cmd_restart (assuan_context_t ctx, char *line)
if (app)
{
ctrl->app_ctx = NULL;
release_application (app);
release_application (app, 0);
}
if (locked_session && ctrl->server_local == locked_session)
{
@ -1922,7 +1922,7 @@ send_client_notifications (app_t app, int removal)
{
sl->ctrl_backlink->app_ctx = NULL;
sl->card_removed = 1;
release_application (app);
release_application (app, 1);
}
if (!sl->event_signal || !sl->assuan_ctx)