[Pkg-gnupg-commit] [gnupg2] 01/02: updated scdaemon fix from gniibe (Closes: #862032)

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue May 9 04:35:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 327ddd27d6cdea37a438e4909c94daeb4daec27c
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Mon May 8 16:45:02 2017 -0400

    updated scdaemon fix from gniibe (Closes: #862032)
---
 debian/patches/0030-scd-Fix-factory-reset.patch | 52 ++++++++++++++++---------
 1 file changed, 33 insertions(+), 19 deletions(-)

diff --git a/debian/patches/0030-scd-Fix-factory-reset.patch b/debian/patches/0030-scd-Fix-factory-reset.patch
index 09951bb..6a8822e 100644
--- a/debian/patches/0030-scd-Fix-factory-reset.patch
+++ b/debian/patches/0030-scd-Fix-factory-reset.patch
@@ -9,16 +9,18 @@ Backport from master branch:
     99d4dfe83
     e2792813a
     031e3fa7b
+
+Additionally, fix another bug when tested with 2.1.18-7 with PC/SC.
 ---
  scd/app-common.h |  3 +-
- scd/app.c        | 83 +++++++++++++++++++++++++++++++-------------------------
+ scd/app.c        | 86 ++++++++++++++++++++++++++++++++------------------------
  scd/command.c    |  6 ++--
- scd/scdaemon.c   | 51 +++++++++++++++++++++++++++++++---
+ scd/scdaemon.c   | 51 ++++++++++++++++++++++++++++++---
  scd/scdaemon.h   |  1 +
- 5 files changed, 99 insertions(+), 45 deletions(-)
+ 5 files changed, 102 insertions(+), 45 deletions(-)
 
 diff --git a/scd/app-common.h b/scd/app-common.h
-index b979f5476..c7a057521 100644
+index b979f54..c7a0575 100644
 --- a/scd/app-common.h
 +++ b/scd/app-common.h
 @@ -54,6 +54,7 @@ struct app_ctx_s {
@@ -39,7 +41,7 @@ index b979f5476..c7a057521 100644
  gpg_error_t app_write_learn_status (app_t app, ctrl_t ctrl,
                                      unsigned int flags);
 diff --git a/scd/app.c b/scd/app.c
-index 8fb0d4553..af86ab830 100644
+index 8fb0d45..3f3f3ef 100644
 --- a/scd/app.c
 +++ b/scd/app.c
 @@ -136,40 +136,32 @@ check_application_conflict (const char *name, app_t app)
@@ -94,7 +96,15 @@ index 8fb0d4553..af86ab830 100644
    return err;
  }
  
-@@ -465,6 +457,8 @@ deallocate_app (app_t app)
+@@ -370,6 +362,7 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
+         }
+ 
+       apdu_dev_list_finish (l);
++      scd_kick_the_loop ();
+     }
+ 
+   npth_mutex_lock (&app_list_lock);
+@@ -465,6 +458,8 @@ deallocate_app (app_t app)
      }
  
    xfree (app->serialno);
@@ -103,7 +113,7 @@ index 8fb0d4553..af86ab830 100644
    xfree (app);
  }
  
-@@ -474,7 +468,7 @@ deallocate_app (app_t app)
+@@ -474,7 +469,7 @@ deallocate_app (app_t app)
     actually deferring the deallocation to allow for a later reuse by
     a new connection. */
  void
@@ -112,7 +122,7 @@ index 8fb0d4553..af86ab830 100644
  {
    if (!app)
      return;
-@@ -484,9 +478,15 @@ release_application (app_t app)
+@@ -484,9 +479,15 @@ release_application (app_t app)
       is using the card - this way the PIN cache and other cached data
       are preserved.  */
  
@@ -131,7 +141,7 @@ index 8fb0d4553..af86ab830 100644
  }
  
  
-@@ -1023,11 +1023,16 @@ scd_update_reader_status_file (void)
+@@ -1023,11 +1024,16 @@ scd_update_reader_status_file (void)
    npth_mutex_lock (&app_list_lock);
    for (a = app_top; a; a = app_next)
      {
@@ -150,7 +160,7 @@ index 8fb0d4553..af86ab830 100644
            sw = apdu_get_status (a->slot, 0, &status);
  
            if (sw == SW_HOST_NO_READER)
-@@ -1038,22 +1043,26 @@ scd_update_reader_status_file (void)
+@@ -1038,24 +1044,30 @@ scd_update_reader_status_file (void)
            else if (sw)
              {
                /* Get status failed.  Ignore that.  */
@@ -166,12 +176,6 @@ index 8fb0d4553..af86ab830 100644
  
 -          if (a->card_status != status)
 +          if (status == 0)
-+            {
-+              log_debug ("Removal of a card: %d\n", a->slot);
-+              apdu_close_reader (a->slot);
-+              deallocate_app (a);
-+            }
-+          else
              {
 -              report_change (a->slot, a->card_status, status);
 -              send_client_notifications (a, status == 0);
@@ -184,13 +188,23 @@ index 8fb0d4553..af86ab830 100644
 -                }
 -              else
 -                a->card_status = status;
++              log_debug ("Removal of a card: %d\n", a->slot);
++              apdu_close_reader (a->slot);
++              deallocate_app (a);
++            }
++          else
++            {
 +              a->card_status = status;
 +              unlock_app (a);
              }
          }
++      else
++        unlock_app (a);
      }
+   npth_mutex_unlock (&app_list_lock);
+ }
 diff --git a/scd/command.c b/scd/command.c
-index 0ae6d29aa..b17c4a109 100644
+index 0ae6d29..b17c4a1 100644
 --- a/scd/command.c
 +++ b/scd/command.c
 @@ -227,7 +227,7 @@ open_card_with_request (ctrl_t ctrl, const char *apptype, const char *serialno)
@@ -221,7 +235,7 @@ index 0ae6d29aa..b17c4a109 100644
  
          if (!sl->event_signal || !sl->assuan_ctx)
 diff --git a/scd/scdaemon.c b/scd/scdaemon.c
-index 74fed4454..02f0e7221 100644
+index 74fed44..02f0e72 100644
 --- a/scd/scdaemon.c
 +++ b/scd/scdaemon.c
 @@ -52,6 +52,7 @@
@@ -340,7 +354,7 @@ index 74fed4454..02f0e7221 100644
    log_info (_("%s %s stopped\n"), strusage(11), strusage(13));
    npth_attr_destroy (&tattr);
 diff --git a/scd/scdaemon.h b/scd/scdaemon.h
-index d0bc98efe..fcab6489f 100644
+index d0bc98e..fcab648 100644
 --- a/scd/scdaemon.h
 +++ b/scd/scdaemon.h
 @@ -125,6 +125,7 @@ void send_status_info (ctrl_t ctrl, const char *keyword, ...)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list