[git] GnuPG - branch, master, updated. gnupg-2.1.18-69-gda4c132

by NIIBE Yutaka cvs at cvs.gnupg.org
Mon Feb 13 03:24:51 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  da4c132cca2c6df81243c9660b7348268a848f88 (commit)
      from  5996c7bf99f3a681393fd9589276399ebc956cff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit da4c132cca2c6df81243c9660b7348268a848f88
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Feb 13 11:09:13 2017 +0900

    scd: Fix use case of PC/SC.
    
    * scd/apdu.c (apdu_open_reader): Add an argument APP_EMPTY.
    When CCID driver fails to open, try PC/SC if APP is nothing.
    * scd/app.c (select_application): Supply arg if APP is nothing.
    
    --
    
    After scanning available card readers by CCID driver, scdaemon should
    try PC/SC service if no APP is registered yet.  Also, when the slot
    is allocated for PC/SC (ccid.handle==NULL), it should not call
    ccid_compare_BAI, otherwise scdaemon crashes.
    
    Debian-bug-id: 852702, 854005, 854595, 854616
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/scd/apdu.c b/scd/apdu.c
index 6fc62aa..82d53b1 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -3127,7 +3127,7 @@ apdu_open_one_reader (const char *portstr)
 }
 
 int
-apdu_open_reader (struct dev_list *dl)
+apdu_open_reader (struct dev_list *dl, int app_empty)
 {
   int slot;
 
@@ -3177,6 +3177,7 @@ apdu_open_reader (struct dev_list *dl)
           /* Check identity by BAI against already opened HANDLEs.  */
           for (slot = 0; slot < MAX_READER; slot++)
             if (reader_table[slot].used
+                && reader_table[slot].ccid.handle
                 && ccid_compare_BAI (reader_table[slot].ccid.handle, bai))
               break;
 
@@ -3201,12 +3202,19 @@ apdu_open_reader (struct dev_list *dl)
             dl->idx++;
         }
 
-      slot = -1;
+      /* Not found.  Try one for PC/SC, only when it's the initial scan.  */
+      if (app_empty && dl->idx == dl->idx_max)
+        {
+          dl->idx++;
+          slot = apdu_open_one_reader (dl->portstr);
+        }
+      else
+        slot = -1;
     }
   else
 #endif
     { /* PC/SC readers.  */
-      if (dl->idx == 0)
+      if (app_empty && dl->idx == 0)
         {
           dl->idx++;
           slot = apdu_open_one_reader (dl->portstr);
diff --git a/scd/apdu.h b/scd/apdu.h
index 473def5..6751e8c 100644
--- a/scd/apdu.h
+++ b/scd/apdu.h
@@ -91,7 +91,7 @@ gpg_error_t apdu_dev_list_start (const char *portstr, struct dev_list **l_p);
 void apdu_dev_list_finish (struct dev_list *l);
 
 /* Note, that apdu_open_reader returns no status word but -1 on error. */
-int apdu_open_reader (struct dev_list *l);
+int apdu_open_reader (struct dev_list *l, int app_empty);
 int apdu_open_remote_reader (const char *portstr,
                              const unsigned char *cookie, size_t length,
                              int (*readfnc) (void *opaque,
diff --git a/scd/app.c b/scd/app.c
index 5b8da1c..7e72870 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -343,7 +343,7 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
           int slot;
           int periodical_check_needed_this;
 
-          slot = apdu_open_reader (l);
+          slot = apdu_open_reader (l, !app_top);
           if (slot < 0)
             break;
 

-----------------------------------------------------------------------

Summary of changes:
 scd/apdu.c | 14 +++++++++++---
 scd/apdu.h |  2 +-
 scd/app.c  |  2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list