aboutsummaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-02-23 09:15:34 +0000
committerWerner Koch <[email protected]>2011-02-23 09:15:34 +0000
commit7c03c8cc65e68f1d77a5a5a497025191fe5df5e9 (patch)
tree8916c0dabdbcbc772c803217510cad6bf7c633ed /scd
parentFix ChnageLog entries. (diff)
downloadgnupg-7c03c8cc65e68f1d77a5a5a497025191fe5df5e9.tar.gz
gnupg-7c03c8cc65e68f1d77a5a5a497025191fe5df5e9.zip
Lock scdaemon to CCID if once found.
This solves a problem where ccid was used, the card unplugged and then scdaemon tries to find a new (plugged in) reader and thus will eventually try PC/SC over and over again. Also added an explicit --kill command to gpgconf.
Diffstat (limited to 'scd')
-rw-r--r--scd/ChangeLog4
-rw-r--r--scd/apdu.c18
2 files changed, 20 insertions, 2 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog
index 0006f743c..0a614c855 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-23 Werner Koch <[email protected]>
+
+ * apdu.c (apdu_open_reader): Lock in to CCID if used once.
+
2011-01-25 NIIBE Yutaka <[email protected]>,
Grant Olson <[email protected]> (wk)
diff --git a/scd/apdu.c b/scd/apdu.c
index 8080b42a1..176ab914b 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1,5 +1,6 @@
/* apdu.c - ISO 7816 APDU functions and low level I/O
- * Copyright (C) 2003, 2004, 2008, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2004, 2008, 2009, 2010,
+ * 2011 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -2355,12 +2356,25 @@ apdu_open_reader (const char *portstr, int *r_no_service)
#ifdef HAVE_LIBUSB
if (!opt.disable_ccid)
{
+ static int once_available;
int i;
const char *s;
slot = open_ccid_reader (portstr);
if (slot != -1)
- return slot; /* got one */
+ {
+ once_available = 1;
+ return slot; /* got one */
+ }
+
+ /* If we ever loaded successfully loaded a CCID reader we never
+ want to fallback to another driver. This solves a problem
+ where ccid was used, the card unplugged and then scdaemon
+ tries to find a new reader and will eventually try PC/SC over
+ and over again. To reset this flag "gpgconf --kill scdaemon"
+ can be used. */
+ if (once_available)
+ return -1;
/* If a CCID reader specification has been given, the user does
not want a fallback to other drivers. */