aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2012-12-04 05:37:56 +0000
committerWerner Koch <[email protected]>2012-12-04 09:48:20 +0000
commit1e1326aeb8923782138e133f091afec41d969c40 (patch)
treefddf46b54ec4bfb1c7fdd2ce318dafd86aa36bd2 /scd/command.c
parentDon't keep opening unavailable card reader. (diff)
downloadgnupg-1e1326aeb8923782138e133f091afec41d969c40.tar.gz
gnupg-1e1326aeb8923782138e133f091afec41d969c40.zip
Revert SCD changes of 2010-05-03.
* scd/apdu.c (pcsc_no_service): Remove. (open_pcsc_reader_direct, open_pcsc_reader_wrapped): Remove pcsc_no_service support. (apdu_open_reader): Remove R_NO_SERVICE. * scd/apdu.h (apdu_open_reader): Remove R_NO_SERVICE. * scd/command.c (reader_disabled): Remove. (get_current_reader): Follow the change of R_NO_SERVICE. (open_card, cmd_serialno, scd_command_handler): Remove reader_disabled support. * scd/sc-copykeys.c (main): Follow the change of R_NO_SERVICE. -- Daemon should handle all possible cases. Even if such a difficult case like reader_disabled, it should not exit.
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/scd/command.c b/scd/command.c
index 932db6ca1..40e61a48b 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -79,10 +79,6 @@
== locked_session->ctrl_backlink->server_local->vreader_idx))
-/* Flag indicating that the reader has been disabled. */
-static int reader_disabled;
-
-
/* This structure is used to keep track of user readers. To
eventually accommodate this structure for RFID cards, where more
than one card is used per reader, we name it virtual reader. */
@@ -444,9 +440,7 @@ get_current_reader (void)
/* Try to open the reader. */
if (vr->slot == -1)
{
- int no_service_flag;
-
- vr->slot = apdu_open_reader (opt.reader_port, &no_service_flag);
+ vr->slot = apdu_open_reader (opt.reader_port);
/* If we still don't have a slot, we have no readers.
Invalidate for now until a reader is attached. */
@@ -454,12 +448,6 @@ get_current_reader (void)
{
vr->valid = 0;
}
-
- if (no_service_flag)
- {
- log_info ("no card services - disabling scdaemon\n");
- reader_disabled = 1;
- }
}
/* Return the vreader index or -1. */
@@ -474,9 +462,6 @@ open_card (ctrl_t ctrl, const char *apptype)
gpg_error_t err;
int vrdr;
- if (reader_disabled)
- return gpg_error (GPG_ERR_NOT_OPERATIONAL);
-
/* If we ever got a card not present error code, return that. Only
the SERIALNO command and a reset are able to clear from that
state. */
@@ -512,7 +497,7 @@ open_card (ctrl_t ctrl, const char *apptype)
vrdr = get_current_reader ();
ctrl->server_local->vreader_idx = vrdr;
if (vrdr == -1)
- err = gpg_error (reader_disabled? GPG_ERR_NOT_OPERATIONAL: GPG_ERR_CARD);
+ err = gpg_error (GPG_ERR_CARD);
else
{
/* Fixme: We should move the apdu_connect call to
@@ -570,7 +555,7 @@ cmd_serialno (assuan_context_t ctx, char *line)
/* Clear the remove flag so that the open_card is able to reread it. */
retry:
- if (!reader_disabled && ctrl->server_local->card_removed)
+ if (ctrl->server_local->card_removed)
{
if ( IS_LOCKED (ctrl) )
return gpg_error (GPG_ERR_LOCKED);
@@ -2122,7 +2107,7 @@ scd_command_handler (ctrl_t ctrl, int fd)
BUG ();
sl->next_session = ctrl->server_local->next_session;
}
- stopme = ctrl->server_local->stopme || reader_disabled;
+ stopme = ctrl->server_local->stopme;
xfree (ctrl->server_local);
ctrl->server_local = NULL;