Completed patch for scdaemon and smartcard/reader combos
Grant Olson
kgo at grant-olson.net
Fri Jan 21 07:51:23 CET 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
This is three-quarters NIIBE and one-quarter me, but I though it would
be easier to have a single complete patch that applies to
STABLE-BRANCH-2-0 than two patches floating around.
- From 6c150e73c3bb03bc1cbf6021cba2af32a624b76c Mon Sep 17 00:00:00 2001
From: grant <grant at johnyaya.(none)>
Date: Fri, 21 Jan 2011 00:36:02 -0500
Subject: [PATCH] Fix for scdaemon so you cand remove and reinsert
card/reader combos
without locking up the daemon.
This is basically NIIBE Yatuka's patch here:
http://lists.gnupg.org/pipermail/gnupg-devel/2010-November/025828.html
Plus another check that closes down the reader explicitly if we get a
SW_HOST_NO_READER error, so that an unplugged reader doesn't hold onto
the first slot, preventing us from getting to the active plugged reader.
- ---
scd/command.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/scd/command.c b/scd/command.c
index e2cd1f5..ba0d997 100644
- --- a/scd/command.c
+++ b/scd/command.c
@@ -309,7 +309,7 @@ do_reset (ctrl_t ctrl, int send_reset)
{
if (apdu_reset (slot))
{
- - slot_table[slot].reset_failed = 1;
+ slot_table[slot].valid = 0;
}
application_notify_card_reset (slot);
}
@@ -401,6 +401,14 @@ get_reader_slot (void)
{
int no_service_flag;
ss->slot = apdu_open_reader (opt.reader_port, &no_service_flag);
+
+ /* If we still don't have a slot, we have no readers.
+ Invalidate for now until a reader is attached. */
+ if(ss->slot == -1)
+ {
+ ss->valid = 0;
+ }
+
if (no_service_flag)
{
log_info ("no card services - disabling scdaemon\n");
@@ -2192,6 +2200,8 @@ update_reader_status_file (int set_card_removed_flag)
if (sw_apdu == SW_HOST_NO_READER)
{
/* Most likely the _reader_ has been unplugged. */
+ apdu_close_reader(ss->slot);
+ ss->valid = 0;
status = 0;
changed = ss->changed;
}
- --
1.7.1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18-gitabceb05 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBCgAGBQJNOSzhAAoJEP5F5V2hilTWfEAH/1zfgg4dpBjmqfwaTGRgwecC
ZWD9WAu/V9PvFUaAES2HTax+Vnrh3HAf9Mwflpzp34+vTbctpkcW9CNb018fu81c
y3hgUmmQdunJx+ZhZHTvMZE3Qxl6sX57cBMSnkVW/H+nleMYf3wwMG3JskeUNOmP
7QJjJZo+mRT1czEx0psY3EqAZpfKhYBhfBygb3S4Zidzwp32Xx1F8v0He5PwiS8H
HmgnlW/K+0XL+rLuwGBPo7YjPWEtpcxWhBKPTylPqw5WKfhGnIZS7m03WevXfegN
+KmK3zHqs/JpDP+U+8fuNhaNDlpqF0LzeuNh1wAUQvu93vCGUuH8XBrUHQj2y3w=
=hB+O
-----END PGP SIGNATURE-----
More information about the Gnupg-devel
mailing list