scdaemon: once error, no success any more

NIIBE Yutaka gniibe at fsij.org
Thu Nov 18 08:11:34 CET 2010


Hi,

I am using GnuPG 2.0.14 in Debian (gnupg2 2.0.14-2).  I am reading
the code of SVN trunk (revision 5485).

When I mistakenly invoke 'gpg --card-status' with no token inserted,
it fails.  Then, I insert Gnuk Token, but 'gpg --card-status' or any
card access do not get success any more.  It seems that there is no
way for scdaemon to recover from failure.

A patch like following improves the situation.

Index: scd/command.c
===================================================================
--- scd/command.c	(revision 5485)
+++ scd/command.c	(working copy)
@@ -305,7 +305,11 @@
     {
       if (apdu_reset (slot))
         {
+#if 0
           slot_table[slot].reset_failed = 1;
+#else
+          slot_table[slot].valid = 0;
+#endif
         }
       application_notify_card_reset (slot);
     }
@@ -394,7 +398,11 @@

   /* Try to open the reader. */
   if (ss->slot == -1)
-    ss->slot = apdu_open_reader (opt.reader_port);
+    {
+      ss->slot = apdu_open_reader (opt.reader_port);
+      if (ss->slot == -1)
+	ss->valid = 0;
+    }

   /* Return the slot_table index.  */
   return 0;
-- 



More information about the Gnupg-devel mailing list