mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Revert SCD changes of 2010-05-03 (scd/ChangeLog 2010-03-17).
* 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_reader_slot): 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.
This commit is contained in:
parent
9afd2bb7fb
commit
0d7cf7bb06
4 changed files with 9 additions and 44 deletions
27
scd/apdu.c
27
scd/apdu.c
|
@ -305,9 +305,6 @@ long (* DLSTDCALL pcsc_control) (unsigned long card,
|
|||
unsigned long recv_len,
|
||||
unsigned long *bytes_returned);
|
||||
|
||||
/* Flag set if PC/SC returned the no-service error. */
|
||||
static int pcsc_no_service;
|
||||
|
||||
|
||||
/* Prototypes. */
|
||||
static int pcsc_get_status (int slot, unsigned int *status);
|
||||
|
@ -1712,11 +1709,8 @@ open_pcsc_reader_direct (const char *portstr)
|
|||
pcsc_error_string (err), err);
|
||||
reader_table[slot].used = 0;
|
||||
unlock_slot (slot);
|
||||
if (err == PCSC_E_NO_SERVICE)
|
||||
pcsc_no_service = 1;
|
||||
return -1;
|
||||
}
|
||||
pcsc_no_service = 0;
|
||||
|
||||
err = pcsc_list_readers (reader_table[slot].pcsc.context,
|
||||
NULL, NULL, &nreader);
|
||||
|
@ -1820,7 +1814,6 @@ open_pcsc_reader_wrapped (const char *portstr)
|
|||
{
|
||||
log_error ("can't run PC/SC access module `%s': %s\n",
|
||||
wrapperpgm, strerror (errno));
|
||||
pcsc_no_service = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1920,8 +1913,6 @@ open_pcsc_reader_wrapped (const char *portstr)
|
|||
;
|
||||
#undef WAIT
|
||||
|
||||
pcsc_no_service = 1;
|
||||
|
||||
/* Now send the open request. */
|
||||
msgbuf[0] = 0x01; /* OPEN command. */
|
||||
len = portstr? strlen (portstr):0;
|
||||
|
@ -1954,15 +1945,11 @@ open_pcsc_reader_wrapped (const char *portstr)
|
|||
{
|
||||
log_error ("PC/SC returned a too large ATR (len=%lx)\n",
|
||||
(unsigned long)len);
|
||||
pcsc_no_service = 0;
|
||||
goto command_failed;
|
||||
}
|
||||
err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
|
||||
| (msgbuf[7] << 8 ) | msgbuf[8]);
|
||||
|
||||
if (err != PCSC_E_NO_SERVICE)
|
||||
pcsc_no_service = 0;
|
||||
|
||||
if (err)
|
||||
{
|
||||
log_error ("PC/SC OPEN failed: %s (0x%08x)\n",
|
||||
|
@ -2803,18 +2790,14 @@ open_rapdu_reader (int portno,
|
|||
error. If PORTSTR is NULL we default to a suitable port (for ctAPI:
|
||||
the first USB reader. For PC/SC the first listed reader). */
|
||||
int
|
||||
apdu_open_reader (const char *portstr, int *r_no_service)
|
||||
apdu_open_reader (const char *portstr)
|
||||
{
|
||||
static int pcsc_api_loaded, ct_api_loaded;
|
||||
int slot;
|
||||
|
||||
if (r_no_service)
|
||||
*r_no_service = 0;
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
if (!opt.disable_ccid)
|
||||
{
|
||||
int i;
|
||||
int slot, i;
|
||||
const char *s;
|
||||
|
||||
slot = open_ccid_reader (portstr);
|
||||
|
@ -2947,11 +2930,7 @@ apdu_open_reader (const char *portstr, int *r_no_service)
|
|||
pcsc_api_loaded = 1;
|
||||
}
|
||||
|
||||
slot = open_pcsc_reader (portstr);
|
||||
if (slot == -1 && r_no_service && pcsc_no_service)
|
||||
*r_no_service = 1;
|
||||
|
||||
return slot;
|
||||
return open_pcsc_reader (portstr);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue