[git] GnuPG - branch, master, updated. gnupg-2.1.9-119-gbce0e3f

by NIIBE Yutaka cvs at cvs.gnupg.org
Mon Nov 9 08:20:10 CET 2015


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  bce0e3f71df0709a7d323a688ddf2690c1727a6c (commit)
      from  2242658efe0c975a46c3316bc9171ddbce085e2c (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 bce0e3f71df0709a7d323a688ddf2690c1727a6c
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Nov 9 16:15:44 2015 +0900

    scd: Add reder information to --card-status.
    
    * g10/call-agent.h, g10/call-agent.c (agent_release_card_info)
    g10/card-util.c (card_status): Add READER.
    * scd/apdu.c (close_ccid_reader, open_ccid_reader): Handle RDRNAME.
    (apdu_get_reader_name): New.
    * scd/ccid-driver.c (ccid_open_reader): Add argument to RDRNAME_P.
    * scd/command.c (cmd_learn): Return READER information.

diff --git a/g10/call-agent.c b/g10/call-agent.c
index 6345784..8eb16e4 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -480,6 +480,7 @@ agent_release_card_info (struct agent_card_info_s *info)
   if (!info)
     return;
 
+  xfree (info->reader); info->reader = NULL;
   xfree (info->serialno); info->serialno = NULL;
   xfree (info->apptype); info->apptype = NULL;
   xfree (info->disp_name); info->disp_name = NULL;
@@ -509,7 +510,12 @@ learn_status_cb (void *opaque, const char *line)
   while (spacep (line))
     line++;
 
-  if (keywordlen == 8 && !memcmp (keyword, "SERIALNO", keywordlen))
+  if (keywordlen == 6 && !memcmp (keyword, "READER", keywordlen))
+    {
+      xfree (parm->reader);
+      parm->reader = unescape_status_string (line);
+    }
+  else if (keywordlen == 8 && !memcmp (keyword, "SERIALNO", keywordlen))
     {
       xfree (parm->serialno);
       parm->serialno = store_serialno (line);
diff --git a/g10/call-agent.h b/g10/call-agent.h
index 70421db..fa1b88a 100644
--- a/g10/call-agent.h
+++ b/g10/call-agent.h
@@ -23,6 +23,7 @@
 struct agent_card_info_s
 {
   int error;         /* private. */
+  char *reader;      /* Reader information.  */
   char *apptype;     /* Malloced application type string.  */
   char *serialno;    /* malloced hex string. */
   char *disp_name;   /* malloced. */
diff --git a/g10/card-util.c b/g10/card-util.c
index b8c5054..7196031 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -387,6 +387,11 @@ card_status (estream_t fp, char *serialno, size_t serialnobuflen)
     }
 
   if (opt.with_colons)
+    es_fprintf (fp, "Reader:%s:", info.reader? info.reader : "");
+  else
+    tty_fprintf (fp, "Reader ...........: %s\n",
+                 info.reader? info.reader : "[none]");
+  if (opt.with_colons)
     es_fprintf (fp, "AID:%s:", info.serialno? info.serialno : "");
   else
     tty_fprintf (fp, "Application ID ...: %s\n",
diff --git a/scd/apdu.c b/scd/apdu.c
index 1aebdd3..41790c6 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -2466,6 +2466,7 @@ static int
 close_ccid_reader (int slot)
 {
   ccid_close_reader (reader_table[slot].ccid.handle);
+  reader_table[slot].rdrname = NULL;
   reader_table[slot].used = 0;
   return 0;
 }
@@ -2619,7 +2620,8 @@ open_ccid_reader (const char *portstr)
     return -1;
   slotp = reader_table + slot;
 
-  err = ccid_open_reader (&slotp->ccid.handle, portstr);
+  err = ccid_open_reader (&slotp->ccid.handle, portstr,
+                          (const char **)&slotp->rdrname);
   if (err)
     {
       slotp->used = 0;
@@ -4326,3 +4328,10 @@ apdu_send_direct (int slot, size_t extended_length,
 
   return 0;
 }
+
+
+const char *
+apdu_get_reader_name (int slot)
+{
+  return reader_table[slot].rdrname;
+}
diff --git a/scd/apdu.h b/scd/apdu.h
index 7e30f76..1694eac 100644
--- a/scd/apdu.h
+++ b/scd/apdu.h
@@ -134,6 +134,6 @@ int apdu_send_direct (int slot, size_t extended_length,
                       const unsigned char *apdudata, size_t apdudatalen,
                       int handle_more,
                       unsigned char **retbuf, size_t *retbuflen);
-
+const char *apdu_get_reader_name (int slot);
 
 #endif /*APDU_H*/
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index b64f24c..bf5b735 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -1542,7 +1542,8 @@ ccid_vendor_specific_init (ccid_driver_t handle)
 /* Open the reader with the internal number READERNO and return a
    pointer to be used as handle in HANDLE.  Returns 0 on success. */
 int
-ccid_open_reader (ccid_driver_t *handle, const char *readerid)
+ccid_open_reader (ccid_driver_t *handle, const char *readerid,
+                  const char **rdrname_p)
 {
   int rc = 0;
   struct usb_device *dev = NULL;
@@ -1661,6 +1662,9 @@ ccid_open_reader (ccid_driver_t *handle, const char *readerid)
       free (*handle);
       *handle = NULL;
     }
+  else
+    if (rdrname_p)
+      *rdrname_p = (*handle)->rid;
 
   return rc;
 }
@@ -3735,7 +3739,7 @@ main (int argc, char **argv)
         break;
     }
 
-  rc = ccid_open_reader (&ccid, argc? *argv:NULL);
+  rc = ccid_open_reader (&ccid, argc? *argv:NULL, NULL);
   if (rc)
     return 1;
 
diff --git a/scd/ccid-driver.h b/scd/ccid-driver.h
index e62ad5c..be8a5ce 100644
--- a/scd/ccid-driver.h
+++ b/scd/ccid-driver.h
@@ -111,7 +111,8 @@ typedef struct ccid_driver_s *ccid_driver_t;
 
 int ccid_set_debug_level (int level);
 char *ccid_get_reader_list (void);
-int ccid_open_reader (ccid_driver_t *handle, const char *readerid);
+int ccid_open_reader (ccid_driver_t *handle, const char *readerid,
+                      const char **rdrname_p);
 int ccid_set_progress_cb (ccid_driver_t handle,
                           void (*cb)(void *, const char *, int, int, int),
                           void *cb_arg);
diff --git a/scd/command.c b/scd/command.c
index 41a150b..a7033e8 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -667,9 +667,18 @@ cmd_learn (assuan_context_t ctx, char *line)
      knows about this card */
   if (!only_keypairinfo)
     {
+      int slot;
+      const char *reader;
       char *serial;
       time_t stamp;
 
+      slot = vreader_slot (ctrl->server_local->vreader_idx);
+      reader = apdu_get_reader_name (slot);
+      if (!reader)
+        return out_of_core ();
+      send_status_direct (ctrl, "READER", reader);
+      /* No need to free the string of READER.  */
+
       rc = app_get_serial_and_stamp (ctrl->app_ctx, &serial, &stamp);
       if (rc)
         return rc;

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

Summary of changes:
 g10/call-agent.c  |  8 +++++++-
 g10/call-agent.h  |  1 +
 g10/card-util.c   |  5 +++++
 scd/apdu.c        | 11 ++++++++++-
 scd/apdu.h        |  2 +-
 scd/ccid-driver.c |  8 ++++++--
 scd/ccid-driver.h |  3 ++-
 scd/command.c     |  9 +++++++++
 8 files changed, 41 insertions(+), 6 deletions(-)


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




More information about the Gnupg-commits mailing list