mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
scd: Fix resetting CARD_CTX.
* scd/app.c (deallocate_card): Don't call scd_clear_current_app. (card_reset): Reset ctrl->current_apptype. * scd/command.c (open_card_with_request): Likewise. (send_client_notifications): Likewise. (scd_clear_current_app): Remove. -- It's too late to call scd_clear_current_app from deallocate_card, because CARD_CTX is already reset. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
d4f135c34b
commit
09d000babb
@ -339,6 +339,7 @@ card_reset (card_t card, ctrl_t ctrl, int send_reset)
|
||||
else
|
||||
{
|
||||
ctrl->card_ctx = NULL;
|
||||
ctrl->current_apptype = APPTYPE_NONE;
|
||||
card_unref (card);
|
||||
}
|
||||
|
||||
@ -814,8 +815,6 @@ deallocate_card (card_t card)
|
||||
xfree (a);
|
||||
}
|
||||
|
||||
scd_clear_current_app (card);
|
||||
|
||||
xfree (card->serialno);
|
||||
unlock_card (card);
|
||||
xfree (card);
|
||||
|
@ -249,6 +249,7 @@ open_card_with_request (ctrl_t ctrl,
|
||||
/* Re-scan USB devices. Release CARD, before the scan. */
|
||||
/* FIXME: Is a card_unref sufficient or do we need to deallocate? */
|
||||
ctrl->card_ctx = NULL;
|
||||
ctrl->current_apptype = APPTYPE_NONE;
|
||||
card_unref (card);
|
||||
|
||||
err = select_application (ctrl, apptypestr, &ctrl->card_ctx, 1,
|
||||
@ -1661,6 +1662,7 @@ cmd_restart (assuan_context_t ctx, char *line)
|
||||
if (card)
|
||||
{
|
||||
ctrl->card_ctx = NULL;
|
||||
ctrl->current_apptype = APPTYPE_NONE;
|
||||
card_unref (card);
|
||||
}
|
||||
if (locked_session && ctrl->server_local == locked_session)
|
||||
@ -2079,20 +2081,6 @@ scd_command_handler (ctrl_t ctrl, int fd)
|
||||
}
|
||||
|
||||
|
||||
/* Clear the current application info for CARD from all sessions.
|
||||
* This is used while deallocating a card. */
|
||||
void
|
||||
scd_clear_current_app (card_t card)
|
||||
{
|
||||
struct server_local_s *sl;
|
||||
|
||||
for (sl=session_list; sl; sl = sl->next_session)
|
||||
{
|
||||
if (sl->ctrl_backlink->card_ctx == card)
|
||||
sl->ctrl_backlink->current_apptype = APPTYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send a line with status information via assuan and escape all given
|
||||
buffers. The variable elements are pairs of (char *, size_t),
|
||||
terminated with a (NULL, 0). */
|
||||
@ -2234,6 +2222,7 @@ send_client_notifications (card_t card, int removal)
|
||||
if (removal)
|
||||
{
|
||||
sl->ctrl_backlink->card_ctx = NULL;
|
||||
sl->ctrl_backlink->current_apptype = APPTYPE_NONE;
|
||||
sl->card_removed = 1;
|
||||
card_unref_locked (card);
|
||||
}
|
||||
|
@ -127,7 +127,6 @@ const char *scd_get_socket_name (void);
|
||||
/*-- command.c --*/
|
||||
gpg_error_t initialize_module_command (void);
|
||||
int scd_command_handler (ctrl_t, int);
|
||||
void scd_clear_current_app (card_t card);
|
||||
void send_status_info (ctrl_t ctrl, const char *keyword, ...)
|
||||
GPGRT_ATTR_SENTINEL(1);
|
||||
void send_status_direct (ctrl_t ctrl, const char *keyword, const char *args);
|
||||
|
Loading…
x
Reference in New Issue
Block a user