mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Change how the removed card flag is set.
* scd/command.c (cmd_serialno): Set/clear card removed flags for all connections using the current card. -- This seems to solve the problems I had in gpg-card and ssh. I am not sure why the old code was done this way - maybe an oversight when adding support for multiple cards. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
fb10b6cba4
commit
58b091df83
@ -307,6 +307,7 @@ cmd_serialno (assuan_context_t ctx, char *line)
|
||||
char *serial;
|
||||
const char *demand;
|
||||
int opt_all = has_option (line, "--all");
|
||||
int thisslot;
|
||||
|
||||
if ( IS_LOCKED (ctrl) )
|
||||
return gpg_error (GPG_ERR_LOCKED);
|
||||
@ -327,22 +328,22 @@ cmd_serialno (assuan_context_t ctx, char *line)
|
||||
line = skip_options (line);
|
||||
|
||||
/* Clear the remove flag so that the open_card is able to reread it. */
|
||||
if (ctrl->server_local->card_removed)
|
||||
ctrl->server_local->card_removed = 0;
|
||||
|
||||
if ((rc = open_card_with_request (ctrl, *line? line:NULL, demand, opt_all)))
|
||||
{
|
||||
ctrl->server_local->card_removed = 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Success, clear the card_removed flag for all sessions. */
|
||||
ctrl->server_local->card_removed = 0;
|
||||
rc = open_card_with_request (ctrl, *line? line:NULL, demand, opt_all);
|
||||
/* Now clear or set the card_removed flag for all sessions using the
|
||||
* current slot. In the error case make sure that the flag is set
|
||||
* for the current session. */
|
||||
thisslot = ctrl->card_ctx? ctrl->card_ctx->slot : -1;
|
||||
for (sl=session_list; sl; sl = sl->next_session)
|
||||
{
|
||||
ctrl_t c = sl->ctrl_backlink;
|
||||
|
||||
if (c != ctrl)
|
||||
c->server_local->card_removed = 0;
|
||||
if (c && c->card_ctx && c->card_ctx->slot == thisslot)
|
||||
c->server_local->card_removed = rc? 1 : 0;
|
||||
}
|
||||
if (rc)
|
||||
{
|
||||
ctrl->server_local->card_removed = 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
serial = card_get_serialno (ctrl->card_ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user