mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-24 16:43:28 +02:00
scd: Track the currently selected app.
* scd/scdaemon.h (struct server_control_s): Add 'current_apptype'. * scd/command.c (scd_clear_current_app): New. * scd/app.c (app_new_register): Set it. (deallocate_card): Clear it. -- Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
43dcf93407
commit
91e2931caa
@ -519,9 +519,13 @@ app_new_register (int slot, ctrl_t ctrl, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
card->periodical_check_needed = periodical_check_needed;
|
card->periodical_check_needed = periodical_check_needed;
|
||||||
|
|
||||||
card->next = card_top;
|
card->next = card_top;
|
||||||
card_top = card;
|
card_top = card;
|
||||||
|
|
||||||
|
/* If no current apptype is known for this session, set it now. */
|
||||||
|
if (!ctrl->current_apptype)
|
||||||
|
ctrl->current_apptype = app->apptype;
|
||||||
|
|
||||||
unlock_card (card);
|
unlock_card (card);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -684,8 +688,9 @@ deallocate_card (card_t card)
|
|||||||
xfree (a);
|
xfree (a);
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree (card->serialno);
|
scd_clear_current_app (card);
|
||||||
|
|
||||||
|
xfree (card->serialno);
|
||||||
unlock_card (card);
|
unlock_card (card);
|
||||||
xfree (card);
|
xfree (card);
|
||||||
}
|
}
|
||||||
|
@ -2069,6 +2069,21 @@ 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
|
/* Send a line with status information via assuan and escape all given
|
||||||
buffers. The variable elements are pairs of (char *, size_t),
|
buffers. The variable elements are pairs of (char *, size_t),
|
||||||
terminated with a (NULL, 0). */
|
terminated with a (NULL, 0). */
|
||||||
@ -2181,7 +2196,7 @@ popup_prompt (void *opaque, int on)
|
|||||||
|
|
||||||
|
|
||||||
/* Helper to send the clients a status change notification. Note that
|
/* Helper to send the clients a status change notification. Note that
|
||||||
* this fucntion assumes that APP is already locked. */
|
* this function assumes that APP is already locked. */
|
||||||
void
|
void
|
||||||
send_client_notifications (card_t card, int removal)
|
send_client_notifications (card_t card, int removal)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +106,11 @@ struct server_control_s
|
|||||||
application context. */
|
application context. */
|
||||||
struct card_ctx_s *card_ctx;
|
struct card_ctx_s *card_ctx;
|
||||||
|
|
||||||
|
/* The currently active application for this context. We need to
|
||||||
|
* knw this for cards which are abale to swicth on the fly between
|
||||||
|
* apps. */
|
||||||
|
apptype_t current_apptype;
|
||||||
|
|
||||||
/* Helper to store the value we are going to sign */
|
/* Helper to store the value we are going to sign */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -122,6 +127,7 @@ const char *scd_get_socket_name (void);
|
|||||||
/*-- command.c --*/
|
/*-- command.c --*/
|
||||||
gpg_error_t initialize_module_command (void);
|
gpg_error_t initialize_module_command (void);
|
||||||
int scd_command_handler (ctrl_t, int);
|
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, ...)
|
void send_status_info (ctrl_t ctrl, const char *keyword, ...)
|
||||||
GPGRT_ATTR_SENTINEL(1);
|
GPGRT_ATTR_SENTINEL(1);
|
||||||
void send_status_direct (ctrl_t ctrl, const char *keyword, const char *args);
|
void send_status_direct (ctrl_t ctrl, const char *keyword, const char *args);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user