[git] GPA - branch, master, updated. gpa-0.9.7-3-g6f44c2b

by Werner Koch cvs at cvs.gnupg.org
Tue Aug 25 15:33:11 CEST 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 Assistant".

The branch, master has been updated
       via  6f44c2b8a755c66a95264c141d066066e41718f8 (commit)
      from  071ed43fac92c68c46a1a8fb19a435eebb8927e6 (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 6f44c2b8a755c66a95264c141d066066e41718f8
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Aug 25 15:04:25 2015 +0200

    Improve error handling for the sign key command.
    
    * src/gpgmeedit.c (parse_status_error): New.
    (edit_fnc): Add method to send the default answer.
    (edit_sign_fnc_transit): Send default answer for unknown prompts.
    Take care of ERROR status in the SIGN_CONFIRM state.
    --
    
    This requires GnuPG 2.1.8 to work as desired.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpgmeedit.c b/src/gpgmeedit.c
index 7ff9a05..5f6768f 100644
--- a/src/gpgmeedit.c
+++ b/src/gpgmeedit.c
@@ -193,6 +193,16 @@ struct edit_parms_s
 };
 
 
+/* Parse the args of an ERROR status line and return its error
+   code.  */
+static gpg_error_t
+parse_status_error (const char *args)
+{
+  size_t n = strcspn (args, " \t");
+  return (gpg_error_t)strtoul (args+n, NULL, 10);
+}
+
+
 /* The edit callback proper */
 static gpg_error_t
 edit_fnc (void *opaque, gpgme_status_code_t status,
@@ -279,6 +289,14 @@ edit_fnc (void *opaque, gpgme_status_code_t status,
 	  gpgme_io_write (fd, "\n", 1);
 	}
     }
+  else if (parms->err == gpg_error (GPG_ERR_EAGAIN))
+    {
+      parms->err = 0;
+      if (debug_edit_fsm)
+        g_debug ("edit_fnc: newstate=%d again, default response", parms->state);
+      /* Send an empty line as default response.  */
+      gpgme_io_write (fd, "\n", 1);
+    }
   else
     {
       if (debug_edit_fsm)
@@ -647,6 +665,12 @@ edit_sign_fnc_transit (int current_state, gpgme_status_code_t status,
           next_state = SIGN_ERROR;
           *err = gpg_error (GPG_ERR_UNUSABLE_PUBKEY);
         }
+      else if (status == GPGME_STATUS_GET_LINE
+               || status == GPGME_STATUS_GET_BOOL)
+        {
+          next_state = current_state;
+          *err = gpg_error (GPG_ERR_EAGAIN);
+        }
       else
         {
           next_state = SIGN_ERROR;
@@ -677,6 +701,12 @@ edit_sign_fnc_transit (int current_state, gpgme_status_code_t status,
           next_state = SIGN_ERROR;
           *err = gpg_error (GPG_ERR_UNUSABLE_PUBKEY);
         }
+      else if (status == GPGME_STATUS_GET_LINE
+               || status == GPGME_STATUS_GET_BOOL)
+        {
+          next_state = current_state;
+          *err = gpg_error (GPG_ERR_EAGAIN);
+        }
       else
         {
           next_state = SIGN_ERROR;
@@ -689,6 +719,12 @@ edit_sign_fnc_transit (int current_state, gpgme_status_code_t status,
         {
           next_state = SIGN_SET_CHECK_LEVEL;
         }
+      else if (status == GPGME_STATUS_GET_LINE
+               || status == GPGME_STATUS_GET_BOOL)
+        {
+          next_state = current_state;
+          *err = gpg_error (GPG_ERR_EAGAIN);
+        }
       else
         {
           next_state = SIGN_ERROR;
@@ -701,6 +737,12 @@ edit_sign_fnc_transit (int current_state, gpgme_status_code_t status,
         {
           next_state = SIGN_CONFIRM;
         }
+      else if (status == GPGME_STATUS_GET_LINE
+               || status == GPGME_STATUS_GET_BOOL)
+        {
+          next_state = current_state;
+          *err = gpg_error (GPG_ERR_EAGAIN);
+        }
       else
         {
           next_state = SIGN_ERROR;
@@ -713,6 +755,17 @@ edit_sign_fnc_transit (int current_state, gpgme_status_code_t status,
         {
           next_state = SIGN_QUIT;
         }
+      else if (status == GPGME_STATUS_GET_LINE
+               || status == GPGME_STATUS_GET_BOOL)
+        {
+          next_state = current_state;
+          *err = gpg_error (GPG_ERR_EAGAIN);
+        }
+      else if (status == GPGME_STATUS_ERROR)
+        {
+          next_state = SIGN_ERROR;
+          *err = parse_status_error (args);
+        }
       else
         {
           next_state = SIGN_ERROR;
diff --git a/src/server.c b/src/server.c
index 0c7209a..5f75202 100644
--- a/src/server.c
+++ b/src/server.c
@@ -484,7 +484,7 @@ prepare_io_streams (assuan_context_t ctx,
 #endif
       if (!ctrl->input_channel)
         {
-          g_debug ("error creating input channel");
+          /* g_debug ("error creating input channel"); */
           err = gpg_error (GPG_ERR_EIO);
           goto leave;
         }

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

Summary of changes:
 src/gpgmeedit.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/server.c    |  2 +-
 2 files changed, 54 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list