diff options
author | Werner Koch <[email protected]> | 2011-12-13 15:55:42 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2011-12-13 15:55:42 +0000 |
commit | 24e121ef261731069868ca403b818f1168237f53 (patch) | |
tree | 358c72a405ba2c2688c1bf50e7201181f3aa76d3 /scd/app.c | |
parent | scd: Retry command SERIALNO for an inactive card. (diff) | |
download | gnupg-24e121ef261731069868ca403b818f1168237f53.tar.gz gnupg-24e121ef261731069868ca403b818f1168237f53.zip |
scd: Introduce a virtual reader table.
The vreader table makes the code more clear by explicitly talking
about APDU slots and reader indices. It also accommodates for future
extensions.
* scd/scdaemon.h (server_control_s): Remove READER_SLOT.
* scd/scdaemon.c (scd_init_default_ctrl): Do not init READER_SLOT.
* scd/app.c (check_application_conflict): Add arg SLOT.
* scd/command.c (slot_status_s): Rename to vreader_s.
(server_local_s): Add field VREADER_IDX as replacement for
the READER_SLOT in server_control_s. Change all users.
(slot_table): Rename to vreader_table. Change all users.
(vreader_slot): New.
(do_reset, cmd_apdu): Map vreader to apdu slot.
(get_reader_slot): Rename to get_current_reader. Return -1 on error.
(open_card): Map vreader toapdu slot. Pass slot to
check_application_conflict.
(scd_command_handler): Init VREADER_IDX.
(update_reader_status_file): Reset SLOT field on error.
Diffstat (limited to 'scd/app.c')
-rw-r--r-- | scd/app.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -213,18 +213,19 @@ application_notify_card_reset (int slot) used to request a specific application and the connection has already done a select_application. */ gpg_error_t -check_application_conflict (ctrl_t ctrl, const char *name) +check_application_conflict (ctrl_t ctrl, int slot, const char *name) { - int slot = ctrl->reader_slot; app_t app; + (void)ctrl; + if (slot < 0 || slot >= DIM (lock_table)) return gpg_error (GPG_ERR_INV_VALUE); app = lock_table[slot].initialized ? lock_table[slot].app : NULL; if (app && app->apptype && name) if ( ascii_strcasecmp (app->apptype, name)) - return gpg_error (GPG_ERR_CONFLICT); + return gpg_error (GPG_ERR_CONFLICT); return 0; } |