[git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.13-6-g14e5435

by Neal H. Walfield cvs at cvs.gnupg.org
Tue Feb 19 07:55:59 CET 2019


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, STABLE-BRANCH-2-2 has been updated
       via  14e5435afb50dc9a9243ff3e0aed5030beba2914 (commit)
       via  005e951714ff62087b8c8802e05d14b7998826f3 (commit)
       via  90e5f49b6a2e002d3c67a041a076f07aeb7a7f54 (commit)
       via  6e422b5135c71f8fa859a3f4de51bf89e3ff5ac6 (commit)
      from  a09bba976d2f5694011a9291189a70a0f3c4caae (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 14e5435afb50dc9a9243ff3e0aed5030beba2914
Author: Neal H. Walfield <neal at g10code.com>
Date:   Fri Oct 6 11:51:39 2017 +0200

    gpg: Fix comparison.
    
    * g10/gpgcompose.c (literal_name): Complain if passed zero arguments,
    not one or fewer.
    
    --
    
    Cherry-picked master commit of:
    	1ed21eee79749b976b4a935f2279b162634e9c5e
    
    Signed-off-by: Neal H. Walfield <neal at walfield.org>

diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
index 430538e..226f793 100644
--- a/g10/gpgcompose.c
+++ b/g10/gpgcompose.c
@@ -2746,7 +2746,7 @@ literal_name (const char *option, int argc, char *argv[], void *cookie)
 {
   struct litinfo *li = cookie;
 
-  if (argc <= 1)
+  if (argc <= 0)
     log_fatal ("Usage: %s NAME\n", option);
 
   if (strlen (argv[0]) > 255)

commit 005e951714ff62087b8c8802e05d14b7998826f3
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Sep 20 10:42:28 2017 +0900

    agent: Fix cancellation handling for scdaemon.
    
    * agent/call-scd.c (cancel_inquire): Remove.
    (agent_card_pksign, agent_card_pkdecrypt, agent_card_writekey)
    (agent_card_scd): Don't call cancel_inquire.
    
    --
    
    Cherry-picked master commit of:
    	9f5e50e7c85aa8b847d38010241ed570ac114fc3
    
    Since libassuan 2.1.0, cancellation command "CAN" is handled within
    the library, by assuan_transact.  So, cancel_inquire just caused
    spurious "CAN" command to scdaemon which resulted an error.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/agent/call-scd.c b/agent/call-scd.c
index 16139fd..51d9abd 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -89,7 +89,6 @@ struct inq_needpin_parm_s
   const char *getpin_cb_desc;
   assuan_context_t passthru;  /* If not NULL, pass unknown inquiries
                                  up to the caller.  */
-  int any_inq_seen;
 
   /* The next fields are used by inq_writekey_parm.  */
   const unsigned char *keydata;
@@ -727,7 +726,6 @@ inq_needpin (void *opaque, const char *line)
   size_t pinlen;
   int rc;
 
-  parm->any_inq_seen = 1;
   if ((s = has_leading_keyword (line, "NEEDPIN")))
     {
       line = s;
@@ -811,30 +809,6 @@ hash_algo_option (int algo)
 }
 
 
-static gpg_error_t
-cancel_inquire (ctrl_t ctrl, gpg_error_t rc)
-{
-  gpg_error_t oldrc = rc;
-
-  /* The inquire callback was called and transact returned a
-     cancel error.  We assume that the inquired process sent a
-     CANCEL.  The passthrough code is not able to pass on the
-     CANCEL and thus scdaemon would stuck on this.  As a
-     workaround we send a CANCEL now.  */
-  rc = assuan_write_line (ctrl->scd_local->ctx, "CAN");
-  if (!rc) {
-    char *line;
-    size_t len;
-
-    rc = assuan_read_line (ctrl->scd_local->ctx, &line, &len);
-    if (!rc)
-      rc = oldrc;
-  }
-
-  return rc;
-}
-
-
 /* Create a signature using the current card.  MDALGO is either 0 or
  * gives the digest algorithm.  DESC_TEXT is an additional parameter
  * passed to GETPIN_CB. */
@@ -875,7 +849,6 @@ agent_card_pksign (ctrl_t ctrl,
   inqparm.getpin_cb_arg = getpin_cb_arg;
   inqparm.getpin_cb_desc = desc_text;
   inqparm.passthru = 0;
-  inqparm.any_inq_seen = 0;
   inqparm.keydata = NULL;
   inqparm.keydatalen = 0;
 
@@ -888,9 +861,6 @@ agent_card_pksign (ctrl_t ctrl,
                         put_membuf_cb, &data,
                         inq_needpin, &inqparm,
                         NULL, NULL);
-  if (inqparm.any_inq_seen && (gpg_err_code(rc) == GPG_ERR_CANCELED ||
-	gpg_err_code(rc) == GPG_ERR_ASS_CANCELED))
-    rc = cancel_inquire (ctrl, rc);
 
   if (rc)
     {
@@ -974,7 +944,6 @@ agent_card_pkdecrypt (ctrl_t ctrl,
   inqparm.getpin_cb_arg = getpin_cb_arg;
   inqparm.getpin_cb_desc = desc_text;
   inqparm.passthru = 0;
-  inqparm.any_inq_seen = 0;
   inqparm.keydata = NULL;
   inqparm.keydatalen = 0;
   snprintf (line, DIM(line), "PKDECRYPT %s", keyid);
@@ -982,9 +951,6 @@ agent_card_pkdecrypt (ctrl_t ctrl,
                         put_membuf_cb, &data,
                         inq_needpin, &inqparm,
                         padding_info_cb, r_padding);
-  if (inqparm.any_inq_seen && (gpg_err_code(rc) == GPG_ERR_CANCELED ||
-	gpg_err_code(rc) == GPG_ERR_ASS_CANCELED))
-    rc = cancel_inquire (ctrl, rc);
 
   if (rc)
     {
@@ -1111,15 +1077,11 @@ agent_card_writekey (ctrl_t ctrl,  int force, const char *serialno,
   parms.getpin_cb_arg = getpin_cb_arg;
   parms.getpin_cb_desc= NULL;
   parms.passthru = 0;
-  parms.any_inq_seen = 0;
   parms.keydata = keydata;
   parms.keydatalen = keydatalen;
 
   rc = assuan_transact (ctrl->scd_local->ctx, line, NULL, NULL,
                         inq_writekey_parms, &parms, NULL, NULL);
-  if (parms.any_inq_seen && (gpg_err_code(rc) == GPG_ERR_CANCELED ||
-                             gpg_err_code(rc) == GPG_ERR_ASS_CANCELED))
-    rc = cancel_inquire (ctrl, rc);
   return unlock_scd (ctrl, rc);
 }
 
@@ -1344,7 +1306,6 @@ agent_card_scd (ctrl_t ctrl, const char *cmdline,
   inqparm.getpin_cb_arg = getpin_cb_arg;
   inqparm.getpin_cb_desc = NULL;
   inqparm.passthru = assuan_context;
-  inqparm.any_inq_seen = 0;
   inqparm.keydata = NULL;
   inqparm.keydatalen = 0;
 
@@ -1354,8 +1315,6 @@ agent_card_scd (ctrl_t ctrl, const char *cmdline,
                         pass_data_thru, assuan_context,
                         inq_needpin, &inqparm,
                         pass_status_thru, assuan_context);
-  if (inqparm.any_inq_seen && gpg_err_code(rc) == GPG_ERR_ASS_CANCELED)
-    rc = cancel_inquire (ctrl, rc);
 
   assuan_set_flag (ctrl->scd_local->ctx, ASSUAN_CONVEY_COMMENTS, saveflag);
   if (rc)

commit 90e5f49b6a2e002d3c67a041a076f07aeb7a7f54
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Sep 20 10:06:43 2017 +0900

    scd: Distinguish cancel by user and protocol error.
    
    * scd/apdu.h (SW_HOST_CANCELLED): New.
    * scd/apdu.c (host_sw_string): Support SW_HOST_CANCELLED.
    (pcsc_error_to_sw): Return SW_HOST_CANCELLED for PCSC_E_CANCELLED.
    * scd/iso7816.c (map_sw): Return GPG_ERR_INV_RESPONSE for
    SW_HOST_ABORTED and GPG_ERR_CANCELED for SW_HOST_CANCELLED.
    
    --
    Cherry-picked master commit of:
    	2396055c096884d521c26b76f26263a146207c24
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/scd/apdu.c b/scd/apdu.c
index af77570..274f2db 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -501,6 +501,7 @@ host_sw_string (long err)
     case SW_HOST_ABORTED: return "aborted";
     case SW_HOST_NO_PINPAD: return "no pinpad";
     case SW_HOST_ALREADY_CONNECTED: return "already connected";
+    case SW_HOST_CANCELLED: return "cancelled";
     default: return "unknown host status error";
     }
 }
@@ -607,7 +608,7 @@ pcsc_error_to_sw (long ec)
     {
     case 0:  rc = 0; break;
 
-    case PCSC_E_CANCELLED:           rc = SW_HOST_ABORTED; break;
+    case PCSC_E_CANCELLED:           rc = SW_HOST_CANCELLED; break;
     case PCSC_E_NO_MEMORY:           rc = SW_HOST_OUT_OF_CORE; break;
     case PCSC_E_TIMEOUT:             rc = SW_HOST_CARD_IO_ERROR; break;
     case PCSC_E_NO_SERVICE:
diff --git a/scd/apdu.h b/scd/apdu.h
index 6240134..1392aab 100644
--- a/scd/apdu.h
+++ b/scd/apdu.h
@@ -71,7 +71,8 @@ enum {
   SW_HOST_NO_READER     = 0x1000c,
   SW_HOST_ABORTED       = 0x1000d,
   SW_HOST_NO_PINPAD     = 0x1000e,
-  SW_HOST_ALREADY_CONNECTED = 0x1000f
+  SW_HOST_ALREADY_CONNECTED = 0x1000f,
+  SW_HOST_CANCELLED     = 0x10010
 };
 
 struct dev_list;
diff --git a/scd/iso7816.c b/scd/iso7816.c
index e8b517e..627481f 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -94,8 +94,9 @@ map_sw (int sw)
     case SW_HOST_CARD_IO_ERROR:  ec = GPG_ERR_EIO; break;
     case SW_HOST_GENERAL_ERROR:  ec = GPG_ERR_GENERAL; break;
     case SW_HOST_NO_READER:      ec = GPG_ERR_ENODEV; break;
-    case SW_HOST_ABORTED:        ec = GPG_ERR_CANCELED; break;
+    case SW_HOST_ABORTED:        ec = GPG_ERR_INV_RESPONSE; break;
     case SW_HOST_NO_PINPAD:      ec = GPG_ERR_NOT_SUPPORTED; break;
+    case SW_HOST_CANCELLED:      ec = GPG_ERR_CANCELED; break;
 
     default:
       if ((sw & 0x010000))

commit 6e422b5135c71f8fa859a3f4de51bf89e3ff5ac6
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue Sep 19 12:28:43 2017 +0900

    common: Fix gnupg_wait_processes.
    
    * common/exechelp-posix.c (gnupg_wait_processes): Loop for r_exitcodes
    even if we already see an error.
    
    --
    
    Cherry-picked master commit of:
    	eeb3da6eb717ed6a1a1069a7611eb37503e8672d
    
    The value stored by waitpid for exit code is encoded;  It requires
    decoded by WEXITSTATUS macro, regardless of an error.
    
    For example, when one of processes is already exited and another is
    still running, it resulted wrong value of in r_exitcodes[n].
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index 7237993..3acf74a 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -784,30 +784,32 @@ gnupg_wait_processes (const char **pgmnames, pid_t *pids, size_t count,
         }
     }
 
-  if (ec == 0)
-    for (i = 0; i < count; i++)
-      {
-        if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i]) == 127)
-          {
-            log_error (_("error running '%s': probably not installed\n"),
-                       pgmnames[i]);
-            ec = GPG_ERR_CONFIGURATION;
-          }
-        else if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i]))
-          {
-            if (dummy)
-              log_error (_("error running '%s': exit status %d\n"),
-                         pgmnames[i], WEXITSTATUS (r_exitcodes[i]));
-            else
-              r_exitcodes[i] = WEXITSTATUS (r_exitcodes[i]);
-            ec = GPG_ERR_GENERAL;
-          }
-        else if (!WIFEXITED (r_exitcodes[i]))
-          {
-            log_error (_("error running '%s': terminated\n"), pgmnames[i]);
-            ec = GPG_ERR_GENERAL;
-          }
-      }
+  for (i = 0; i < count; i++)
+    {
+      if (r_exitcodes[i] == -1)
+        continue;
+
+      if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i]) == 127)
+        {
+          log_error (_("error running '%s': probably not installed\n"),
+                     pgmnames[i]);
+          ec = GPG_ERR_CONFIGURATION;
+        }
+      else if (WIFEXITED (r_exitcodes[i]) && WEXITSTATUS (r_exitcodes[i]))
+        {
+          if (dummy)
+            log_error (_("error running '%s': exit status %d\n"),
+                       pgmnames[i], WEXITSTATUS (r_exitcodes[i]));
+          else
+            r_exitcodes[i] = WEXITSTATUS (r_exitcodes[i]);
+          ec = GPG_ERR_GENERAL;
+        }
+      else if (!WIFEXITED (r_exitcodes[i]))
+        {
+          log_error (_("error running '%s': terminated\n"), pgmnames[i]);
+          ec = GPG_ERR_GENERAL;
+        }
+    }
 
   xfree (dummy);
   return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, ec);

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

Summary of changes:
 agent/call-scd.c        | 41 ----------------------------------------
 common/exechelp-posix.c | 50 +++++++++++++++++++++++++------------------------
 g10/gpgcompose.c        |  2 +-
 scd/apdu.c              |  3 ++-
 scd/apdu.h              |  3 ++-
 scd/iso7816.c           |  3 ++-
 6 files changed, 33 insertions(+), 69 deletions(-)


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




More information about the Gnupg-commits mailing list