[git] GnuPG - branch, master, updated. post-nuke-of-trailing-ws-81-g809dfd7

by Werner Koch cvs at cvs.gnupg.org
Wed Jul 27 11:50:04 CEST 2011


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  809dfd70e3d3597ac510517f3b54f40252cfd81e (commit)
       via  29af48840f1f5d39fae8ad7942f3676936134996 (commit)
      from  6f86ee812fa5b063f8feb79f9e3e59eaa59e0209 (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 809dfd70e3d3597ac510517f3b54f40252cfd81e
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Jul 27 11:10:15 2011 +0200

    Make the inquire cancel fix a little bit more robust.

diff --git a/agent/ChangeLog b/agent/ChangeLog
index 25eabbc..60ea7ee 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-27  Werner Koch  <wk at g10code.com>
+
+	* call-scd.c (struct inq_needpin_s): Add field ANY_INQ_SEEN.
+	(inq_needpin): Set it.
+	(agent_card_scd): Send the cancel only if an inquire was actually
+	used.
+
 2011-07-09  Ben Kibbey <bjk at luxsci.net>
 
 	* call-scd.c (agent_card_scd): Send the CANCEL command back to SCD
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 1ffb123..74f94c0 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -92,6 +92,7 @@ struct inq_needpin_s
   void *getpin_cb_arg;
   assuan_context_t passthru;  /* If not NULL, pass unknown inquiries
                                  up to the caller.  */
+  int any_inq_seen;
 };
 
 
@@ -726,6 +727,7 @@ inq_needpin (void *opaque, const char *line)
   size_t pinlen;
   int rc;
 
+  parm->any_inq_seen = 1;
   if (!strncmp (line, "NEEDPIN", 7) && (line[7] == ' ' || !line[7]))
     {
       line += 7;
@@ -857,6 +859,7 @@ agent_card_pksign (ctrl_t ctrl,
   inqparm.getpin_cb = getpin_cb;
   inqparm.getpin_cb_arg = getpin_cb_arg;
   inqparm.passthru = 0;
+  inqparm.any_inq_seen = 0;
   if (ctrl->use_auth_call)
     snprintf (line, sizeof line, "PKAUTH %s", keyid);
   else
@@ -935,6 +938,7 @@ agent_card_pkdecrypt (ctrl_t ctrl,
   inqparm.getpin_cb = getpin_cb;
   inqparm.getpin_cb_arg = getpin_cb_arg;
   inqparm.passthru = 0;
+  inqparm.any_inq_seen = 0;
   snprintf (line, DIM(line)-1, "PKDECRYPT %s", keyid);
   line[DIM(line)-1] = 0;
   rc = assuan_transact (ctrl->scd_local->ctx, line,
@@ -1169,14 +1173,20 @@ agent_card_scd (ctrl_t ctrl, const char *cmdline,
   inqparm.getpin_cb = getpin_cb;
   inqparm.getpin_cb_arg = getpin_cb_arg;
   inqparm.passthru = assuan_context;
+  inqparm.any_inq_seen = 0;
   saveflag = assuan_get_flag (ctrl->scd_local->ctx, ASSUAN_CONVEY_COMMENTS);
   assuan_set_flag (ctrl->scd_local->ctx, ASSUAN_CONVEY_COMMENTS, 1);
   rc = assuan_transact (ctrl->scd_local->ctx, cmdline,
                         pass_data_thru, assuan_context,
                         inq_needpin, &inqparm,
                         pass_status_thru, assuan_context);
-  if (gpg_err_code(rc) == GPG_ERR_ASS_CANCELED)
+  if (inqparm.any_inq_seen && gpg_err_code(rc) == GPG_ERR_ASS_CANCELED)
     {
+      /* 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;

commit 29af48840f1f5d39fae8ad7942f3676936134996
Author: Ben Kibbey <bjk at luxsci.net>
Date:   Sat Jul 9 08:25:22 2011 -0400

    Fixed gpg-agent SCD inquire command cancellation.
    
    Need to send the CANCEL command back to scdaemon otherwise the next SCD
    command will fail.

diff --git a/agent/ChangeLog b/agent/ChangeLog
index e1becac..25eabbc 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-09  Ben Kibbey <bjk at luxsci.net>
+
+	* call-scd.c (agent_card_scd): Send the CANCEL command back to SCD
+	when the SCD command is cancelled from the client.
+
 2011-07-22  Werner Koch  <wk at g10code.com>
 
 	* command-ssh.c (ssh_receive_key): Do not init comment to an empty
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 710589f..1ffb123 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -1175,6 +1175,19 @@ agent_card_scd (ctrl_t ctrl, const char *cmdline,
                         pass_data_thru, assuan_context,
                         inq_needpin, &inqparm,
                         pass_status_thru, assuan_context);
+  if (gpg_err_code(rc) == GPG_ERR_ASS_CANCELED)
+    {
+      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 = gpg_error(GPG_ERR_ASS_CANCELED);
+      }
+    }
+
   assuan_set_flag (ctrl->scd_local->ctx, ASSUAN_CONVEY_COMMENTS, saveflag);
   if (rc)
     {

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

Summary of changes:
 agent/ChangeLog  |   12 ++++++++++++
 agent/call-scd.c |   23 +++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)


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




More information about the Gnupg-commits mailing list