[git] GPGME - branch, master, updated. gpgme-1.11.1-41-ge2aa38b

by Werner Koch cvs at cvs.gnupg.org
Fri Jun 1 00:22:02 CEST 2018


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 "GnuPG Made Easy".

The branch, master has been updated
       via  e2aa38b56a991a0da052acfe7566cc7a146d3bb6 (commit)
       via  2219fc19d58ae1071493de92093b711f3c71454a (commit)
      from  618aa7f08db41911f25632d9fba23bca80908ebe (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 e2aa38b56a991a0da052acfe7566cc7a146d3bb6
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Jun 1 00:13:18 2018 +0200

    core: Remove cruft from the engine-gpg code.
    
    * src/engine-gpg.c (read_status): Remove the handling of
    GPGME_STATUS_END_STREAM; this was used only by the former experimental
    --pipemode of gpg but that is not even anymore invoked here.
    (struct engine_gpg): Remove cmd.linked_data and .linked_idx.
    (build_argv): Remove code for linked_data.
    (gpg_new): Ditto.
    (gpg_set_command_handler): Remove arr linked_data.
    * src/engine-backend.h (engine_ops): Remove arg data from
    set_command_handler.
    * src/engine.c (_gpgme_engine_set_command_handler): Remove arg
    linked_data and adjust all callers.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/decrypt-verify.c b/src/decrypt-verify.c
index 17f79ac..ce4a7a9 100644
--- a/src/decrypt-verify.c
+++ b/src/decrypt-verify.c
@@ -74,7 +74,7 @@ decrypt_verify_start (gpgme_ctx_t ctx, int synchronous,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-	(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+	(ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
 	return err;
     }
diff --git a/src/decrypt.c b/src/decrypt.c
index ecd9c14..7dbc6fd 100644
--- a/src/decrypt.c
+++ b/src/decrypt.c
@@ -510,7 +510,7 @@ _gpgme_decrypt_start (gpgme_ctx_t ctx, int synchronous,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-	(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+	(ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
 	return err;
     }
diff --git a/src/edit.c b/src/edit.c
index ca4d595..2867efb 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -139,8 +139,7 @@ interact_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key,
   opd->fnc_old = NULL;
   opd->fnc_value = fnc_value;
 
-  err = _gpgme_engine_set_command_handler (ctx->engine, command_handler,
-					   ctx, out);
+  err = _gpgme_engine_set_command_handler (ctx->engine, command_handler, ctx);
   if (err)
     return err;
 
@@ -219,8 +218,7 @@ edit_start (gpgme_ctx_t ctx, int synchronous, int type, gpgme_key_t key,
   opd->fnc_old = fnc;
   opd->fnc_value = fnc_value;
 
-  err = _gpgme_engine_set_command_handler (ctx->engine, command_handler,
-					   ctx, out);
+  err = _gpgme_engine_set_command_handler (ctx->engine, command_handler, ctx);
   if (err)
     return err;
 
diff --git a/src/encrypt-sign.c b/src/encrypt-sign.c
index 4db46e2..cc34fbd 100644
--- a/src/encrypt-sign.c
+++ b/src/encrypt-sign.c
@@ -93,7 +93,7 @@ encrypt_sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-	(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+	(ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
 	return err;
     }
diff --git a/src/encrypt.c b/src/encrypt.c
index 2318497..a27a53a 100644
--- a/src/encrypt.c
+++ b/src/encrypt.c
@@ -242,7 +242,7 @@ encrypt_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
     {
       /* Symmetric encryption requires a passphrase.  */
       err = _gpgme_engine_set_command_handler
-	(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+	(ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
 	return err;
     }
diff --git a/src/engine-backend.h b/src/engine-backend.h
index f692666..4f33da1 100644
--- a/src/engine-backend.h
+++ b/src/engine-backend.h
@@ -55,7 +55,7 @@ struct engine_ops
 			      void *fnc_value);
   gpgme_error_t (*set_command_handler) (void *engine,
 					engine_command_handler_t fnc,
-					void *fnc_value, gpgme_data_t data);
+					void *fnc_value);
   gpgme_error_t (*set_colon_line_handler) (void *engine,
 					   engine_colon_line_handler_t fnc,
 					   void *fnc_value);
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index e955820..43d49fe 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -135,10 +135,6 @@ struct engine_gpg
     char *keyword;       /* what has been requested (malloced) */
     engine_command_handler_t fnc;
     void *fnc_value;
-    /* The kludges never end.  This is used to couple command handlers
-       with output data in edit key mode.  */
-    gpgme_data_t linked_data;
-    int linked_idx;
   } cmd;
 
   struct gpgme_io_cbs io_cbs;
@@ -502,8 +498,6 @@ gpg_new (void **engine, const char *file_name, const char *home_dir,
   gpg->colon.fd[1] = -1;
   gpg->cmd.fd = -1;
   gpg->cmd.idx = -1;
-  gpg->cmd.linked_data = NULL;
-  gpg->cmd.linked_idx = -1;
 
   /* Allocate the read buffer for the status pipe.  */
   gpg->status.bufsize = 1024;
@@ -792,14 +786,14 @@ command_handler (void *opaque, int fd)
 
 
 
-/* The Fnc will be called to get a value for one of the commands with
-   a key KEY.  If the Code passed to FNC is 0, the function may release
-   resources associated with the returned value from another call.  To
-   match such a second call to a first call, the returned value from
-   the first call is passed as keyword.  */
+/* The FNC will be called to get a value for one of the commands with
+ * a key KEY.  If the code passed to FNC is 0, the function may
+ * release resources associated with the returned value from another
+ * call.  To match such a second call to a first call, the returned
+ * value from the first call is passed as keyword.  */
 static gpgme_error_t
 gpg_set_command_handler (void *engine, engine_command_handler_t fnc,
-			 void *fnc_value, gpgme_data_t linked_data)
+			 void *fnc_value)
 {
   engine_gpg_t gpg = engine;
   gpgme_error_t rc;
@@ -818,7 +812,6 @@ gpg_set_command_handler (void *engine, engine_command_handler_t fnc,
   gpg->cmd.fnc = fnc;
   gpg->cmd.cb_data = (void *) &gpg->cmd;
   gpg->cmd.fnc_value = fnc_value;
-  gpg->cmd.linked_data = linked_data;
   gpg->cmd.used = 1;
   return 0;
 }
@@ -1076,11 +1069,6 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
 		  assert (gpg->cmd.idx == -1);
 		  gpg->cmd.idx = datac;
 		}
-	      else if (gpg->cmd.linked_data == a->data)
-		{
-		  assert (gpg->cmd.linked_idx == -1);
-		  gpg->cmd.linked_idx = datac;
-		}
 	    }
 
 	  fd_data_map[datac].data = a->data;
@@ -1267,44 +1255,6 @@ read_status (engine_gpg_t gpg)
 			  if (err)
 			    return err;
                         }
-
-		      if (r == GPGME_STATUS_END_STREAM)
-			{
-			  if (gpg->cmd.used)
-			    {
-			      /* Before we can actually add the
-				 command fd, we might have to flush
-				 the linked output data pipe.  */
-			      if (gpg->cmd.linked_idx != -1
-				  && gpg->fd_data_map[gpg->cmd.linked_idx].fd
-				  != -1)
-				{
-				  struct io_select_fd_s fds;
-				  fds.fd =
-				    gpg->fd_data_map[gpg->cmd.linked_idx].fd;
-				  fds.for_read = 1;
-				  fds.for_write = 0;
-				  fds.opaque = NULL;
-				  do
-				    {
-				      fds.signaled = 0;
-				      _gpgme_io_select (&fds, 1, 1);
-				      if (fds.signaled)
-					_gpgme_data_inbound_handler
-					  (gpg->cmd.linked_data, fds.fd);
-				    }
-				  while (fds.signaled);
-				}
-
-			      /* XXX We must check if there are any
-				 more fds active after removing this
-				 one.  */
-			      (*gpg->io_cbs.remove)
-				(gpg->fd_data_map[gpg->cmd.idx].tag);
-			      gpg->cmd.fd = gpg->fd_data_map[gpg->cmd.idx].fd;
-			      gpg->fd_data_map[gpg->cmd.idx].fd = -1;
-			    }
-                        }
                     }
                 }
 	      /* To reuse the buffer for the next line we have to
diff --git a/src/engine.c b/src/engine.c
index b716ca2..b629bea 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -596,8 +596,7 @@ _gpgme_engine_set_status_handler (engine_t engine,
 gpgme_error_t
 _gpgme_engine_set_command_handler (engine_t engine,
 				   engine_command_handler_t fnc,
-				   void *fnc_value,
-				   gpgme_data_t linked_data)
+				   void *fnc_value)
 {
   if (!engine)
     return gpg_error (GPG_ERR_INV_VALUE);
@@ -605,8 +604,7 @@ _gpgme_engine_set_command_handler (engine_t engine,
   if (!engine->ops->set_command_handler)
     return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
 
-  return (*engine->ops->set_command_handler) (engine->engine,
-					      fnc, fnc_value, linked_data);
+  return (*engine->ops->set_command_handler) (engine->engine, fnc, fnc_value);
 }
 
 gpgme_error_t
diff --git a/src/engine.h b/src/engine.h
index 8b692f2..c512a25 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -78,8 +78,7 @@ void _gpgme_engine_set_status_handler (engine_t engine,
 				       void *fnc_value);
 gpgme_error_t _gpgme_engine_set_command_handler (engine_t engine,
 						 engine_command_handler_t fnc,
-						 void *fnc_value,
-						 gpgme_data_t data);
+						 void *fnc_value);
 gpgme_error_t
 _gpgme_engine_set_colon_line_handler (engine_t engine,
 				      engine_colon_line_handler_t fnc,
diff --git a/src/genkey.c b/src/genkey.c
index 16484ec..ffca7e8 100644
--- a/src/genkey.c
+++ b/src/genkey.c
@@ -259,7 +259,7 @@ genkey_start (gpgme_ctx_t ctx, int synchronous, const char *parms,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
         return err;
     }
@@ -345,7 +345,7 @@ createkey_start (gpgme_ctx_t ctx, int synchronous,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
         return err;
     }
@@ -433,7 +433,7 @@ createsubkey_start (gpgme_ctx_t ctx, int synchronous,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
         return err;
     }
@@ -519,7 +519,7 @@ addrevuid_start (gpgme_ctx_t ctx, int synchronous, int extraflags,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
         return err;
     }
diff --git a/src/keysign.c b/src/keysign.c
index c2fcabb..5e49793 100644
--- a/src/keysign.c
+++ b/src/keysign.c
@@ -171,7 +171,7 @@ keysign_start (gpgme_ctx_t ctx, int synchronous,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
         return err;
     }
diff --git a/src/passwd.c b/src/passwd.c
index 5bd67a5..6c03002 100644
--- a/src/passwd.c
+++ b/src/passwd.c
@@ -151,7 +151,7 @@ passwd_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
         return err;
     }
diff --git a/src/sign.c b/src/sign.c
index bfd9ad1..ab4109e 100644
--- a/src/sign.c
+++ b/src/sign.c
@@ -449,7 +449,7 @@ sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t plain,
   if (ctx->passphrase_cb)
     {
       err = _gpgme_engine_set_command_handler
-	(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+	(ctx->engine, _gpgme_passphrase_command_handler, ctx);
       if (err)
 	return err;
     }

commit 2219fc19d58ae1071493de92093b711f3c71454a
Author: Werner Koch <wk at gnupg.org>
Date:   Thu May 31 23:56:06 2018 +0200

    core: Minor cleanup in engine-gpg and -gpgsm.
    
    * src/engine-gpg.c: Remove errno.h.
    (build_argv): Use gpg_error_from_syserror instead of ERRNO.
    * src/engine-gpgsm.c: Remove errno.h.
    (status_handler): Remove check for EINTR; gpgme_data_write already
    handles EINTR.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 173e940..e955820 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
-#include <errno.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -1039,10 +1038,10 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
 	    if (_gpgme_io_pipe (fds, fd_data_map[datac].inbound ? 1 : 0)
 		== -1)
 	      {
-		int saved_errno = errno;
+		int saved_err = gpg_error_from_syserror ();
 		free (fd_data_map);
 		free_argv (argv);
-		return gpg_error (saved_errno);
+		return saved_err;
 	      }
 	    if (_gpgme_io_set_close_notify (fds[0],
 					    close_notify_handler, gpg)
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c
index 7b22183..84a9315 100644
--- a/src/engine-gpgsm.c
+++ b/src/engine-gpgsm.c
@@ -37,7 +37,6 @@
 #include <locale.h>
 #endif
 #include <fcntl.h> /* FIXME */
-#include <errno.h>
 
 #include "gpgme.h"
 #include "util.h"
@@ -986,8 +985,7 @@ status_handler (void *opaque, int fd)
           while (linelen > 0)
             {
               nwritten = gpgme_data_write (gpgsm->inline_data, src, linelen);
-              if (!nwritten || (nwritten < 0 && errno != EINTR)
-                  || nwritten > linelen)
+              if (nwritten <= 0 || nwritten > linelen)
                 {
                   err = gpg_error_from_syserror ();
                   break;

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

Summary of changes:
 src/decrypt-verify.c |  2 +-
 src/decrypt.c        |  2 +-
 src/edit.c           |  6 ++---
 src/encrypt-sign.c   |  2 +-
 src/encrypt.c        |  2 +-
 src/engine-backend.h |  2 +-
 src/engine-gpg.c     | 67 +++++++---------------------------------------------
 src/engine-gpgsm.c   |  4 +---
 src/engine.c         |  6 ++---
 src/engine.h         |  3 +--
 src/genkey.c         |  8 +++----
 src/keysign.c        |  2 +-
 src/passwd.c         |  2 +-
 src/sign.c           |  2 +-
 14 files changed, 26 insertions(+), 84 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list