[git] GPGME - branch, master, updated. gpgme-1.4.2-18-gab6e718

by Werner Koch cvs at cvs.gnupg.org
Tue Jan 7 18:04:25 CET 2014


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  ab6e718327451e418782990c5a0a4e72588e3f0b (commit)
       via  121efcc5618374a1b4450b1d6a18bb3c35edb1fd (commit)
       via  d63058b852b83515e7715103c04a684ecf59838a (commit)
      from  6564e5e78e8c6e5a120675a5699b5b75248cfbc7 (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 ab6e718327451e418782990c5a0a4e72588e3f0b
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jan 7 17:59:59 2014 +0100

    Make gpgconf engine work again - fixes 02ba35c1.
    
    * src/gpgconf.c: Remove ENABLE_GPGCONF and move prototypes to ...
    * src/engine-backend.h: ... here.
    --
    
    gpgconf is a required part for gpgme.

diff --git a/src/engine-backend.h b/src/engine-backend.h
index a768652..7e6c0c1 100644
--- a/src/engine-backend.h
+++ b/src/engine-backend.h
@@ -136,4 +136,16 @@ extern struct engine_ops _gpgme_engine_ops_g13;         /* Crypto VFS. */
 extern struct engine_ops _gpgme_engine_ops_uiserver;
 #endif
 
+
+/* Prototypes for extra functions in engine-gpgconf.c  */
+gpgme_error_t _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
+                                   gpgme_conf_type_t type, const void *value);
+void _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
+gpgme_error_t _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
+				      gpgme_conf_arg_t arg);
+void _gpgme_conf_release (gpgme_conf_comp_t conf);
+gpgme_error_t _gpgme_conf_load (void *engine, gpgme_conf_comp_t *conf_p);
+
+
+
 #endif /* ENGINE_BACKEND_H */
diff --git a/src/gpgconf.c b/src/gpgconf.c
index 47ef47a..6591452 100644
--- a/src/gpgconf.c
+++ b/src/gpgconf.c
@@ -28,18 +28,7 @@
 #include "engine.h"
 #include "debug.h"
 
-#ifdef ENABLE_GPGCONF
-/* engine-gpgconf.c.  */
-gpgme_error_t _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
-				  gpgme_conf_type_t type, const void *value);
-void _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
-gpgme_error_t _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
-				      gpgme_conf_arg_t arg);
-void _gpgme_conf_release (gpgme_conf_comp_t conf);
-gpgme_error_t _gpgme_conf_load (void *engine, gpgme_conf_comp_t *conf_p);
-gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
-
-#endif
+#include "engine-backend.h"
 
 

 /* Allocate a new gpgme_conf_arg_t.  */
@@ -47,11 +36,7 @@ gpgme_error_t
 gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
 		    gpgme_conf_type_t type, const void *value)
 {
-#ifdef ENABLE_GPGCONF
   return _gpgme_conf_arg_new (arg_p, type, value);
-#else
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-#endif
 }
 
 
@@ -59,9 +44,7 @@ gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
 void
 gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
 {
-#ifdef ENABLE_GPGCONF
   _gpgme_conf_arg_release (arg, type);
-#endif
 }
 
 
@@ -69,11 +52,7 @@ gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
 gpgme_error_t
 gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
 {
-#ifdef ENABLE_GPGCONF
   return _gpgme_conf_opt_change (opt, reset, arg);
-#else
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-#endif
 }
 
 
@@ -82,9 +61,7 @@ gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
 void
 gpgme_conf_release (gpgme_conf_comp_t conf)
 {
-#ifdef ENABLE_GPGCONF
   _gpgme_conf_release (conf);
-#endif
 }
 
 
@@ -93,7 +70,6 @@ gpgme_conf_release (gpgme_conf_comp_t conf)
 gpgme_error_t
 gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
 {
-#ifdef ENABLE_GPGCONF
   gpgme_error_t err;
   gpgme_protocol_t proto;
 
@@ -109,9 +85,6 @@ gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
   err = _gpgme_engine_op_conf_load (ctx->engine, conf_p);
   ctx->protocol = proto;
   return err;
-#else
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-#endif
 }
 
 
@@ -119,7 +92,6 @@ gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
 gpgme_error_t
 gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp)
 {
-#ifdef ENABLE_GPGCONF
   gpgme_error_t err;
   gpgme_protocol_t proto;
 
@@ -135,9 +107,6 @@ gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp)
   err = _gpgme_engine_op_conf_save (ctx->engine, comp);
   ctx->protocol = proto;
   return err;
-#else
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-#endif
 }
 
 

commit 121efcc5618374a1b4450b1d6a18bb3c35edb1fd
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jan 7 13:32:08 2014 +0100

    Make gpgme_new return a proper error if no engines are installed.
    
    * src/engine.c (gpgme_get_engine_info): Improve error handling.
    (_gpgme_engine_info_copy): Ditto.
    * src/gpgme.c (gpgme_new): Return error GPG_ERR_NO_ENGINE.

diff --git a/src/engine.c b/src/engine.c
index 80febea..4f2000c 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -182,6 +182,8 @@ _gpgme_engine_info_release (gpgme_engine_info_t info)
 gpgme_error_t
 gpgme_get_engine_info (gpgme_engine_info_t *info)
 {
+  gpgme_error_t err;
+
   LOCK (engine_info_lock);
   if (!engine_info)
     {
@@ -194,6 +196,7 @@ gpgme_get_engine_info (gpgme_engine_info_t *info)
 					GPGME_PROTOCOL_UISERVER };
       unsigned int proto;
 
+      err = 0;
       for (proto = 0; proto < DIM (proto_list); proto++)
 	{
 	  const char *ofile_name = engine_get_file_name (proto_list[proto]);
@@ -205,13 +208,24 @@ gpgme_get_engine_info (gpgme_engine_info_t *info)
 	    continue;
 
 	  file_name = strdup (ofile_name);
-          home_dir = ohome_dir? strdup (ohome_dir): NULL;
+          if (!file_name)
+            err = gpg_error_from_syserror ();
+
+          if (ohome_dir)
+            {
+              home_dir = strdup (ohome_dir);
+              if (!home_dir && !err)
+                err = gpg_error_from_syserror ();
+            }
+          else
+            home_dir = NULL;
 
 	  *lastp = malloc (sizeof (*engine_info));
-	  if (!*lastp || !file_name)
-	    {
-	      int saved_err = gpg_error_from_syserror ();
+          if (!*lastp && !err)
+            err = gpg_error_from_syserror ();
 
+	  if (err)
+	    {
 	      _gpgme_engine_info_release (engine_info);
 	      engine_info = NULL;
 
@@ -221,7 +235,7 @@ gpgme_get_engine_info (gpgme_engine_info_t *info)
 		free (home_dir);
 
 	      UNLOCK (engine_info_lock);
-	      return saved_err;
+	      return err;
 	    }
 
 	  (*lastp)->protocol = proto_list[proto];
@@ -273,11 +287,13 @@ _gpgme_engine_info_copy (gpgme_engine_info_t *r_info)
 
       assert (info->file_name);
       file_name = strdup (info->file_name);
+      if (!file_name)
+        err = gpg_error_from_syserror ();
 
       if (info->home_dir)
 	{
 	  home_dir = strdup (info->home_dir);
-	  if (!home_dir)
+	  if (!home_dir && !err)
 	    err = gpg_error_from_syserror ();
 	}
       else
@@ -286,19 +302,19 @@ _gpgme_engine_info_copy (gpgme_engine_info_t *r_info)
       if (info->version)
 	{
 	  version = strdup (info->version);
-	  if (!version)
+	  if (!version && !err)
 	    err = gpg_error_from_syserror ();
 	}
       else
 	version = NULL;
 
       *lastp = malloc (sizeof (*engine_info));
-      if (!*lastp || !file_name || err)
-	{
-	  int saved_err = gpg_error_from_syserror ();
+      if (!*lastp && !err)
+        err = gpg_error_from_syserror ();
 
+      if (err)
+	{
 	  _gpgme_engine_info_release (new_info);
-
 	  if (file_name)
 	    free (file_name);
 	  if (home_dir)
@@ -307,7 +323,7 @@ _gpgme_engine_info_copy (gpgme_engine_info_t *r_info)
 	    free (version);
 
 	  UNLOCK (engine_info_lock);
-	  return saved_err;
+	  return err;
 	}
 
       (*lastp)->protocol = info->protocol;
diff --git a/src/gpgme.c b/src/gpgme.c
index 4a8afa9..3d00018 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -86,6 +86,7 @@ gpgme_set_global_flag (const char *name, const char *value)
 gpgme_error_t
 gpgme_new (gpgme_ctx_t *r_ctx)
 {
+  gpgme_error_t err;
   gpgme_ctx_t ctx;
   TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx);
 
@@ -101,11 +102,13 @@ gpgme_new (gpgme_ctx_t *r_ctx)
 
   INIT_LOCK (ctx->lock);
 
-  _gpgme_engine_info_copy (&ctx->engine_info);
-  if (!ctx->engine_info)
+  err = _gpgme_engine_info_copy (&ctx->engine_info);
+  if (!err && !ctx->engine_info)
+    err = gpg_error (GPG_ERR_NO_ENGINE);
+  if (err)
     {
       free (ctx);
-      return TRACE_ERR (gpg_error_from_syserror ());
+      return TRACE_ERR (err);
     }
 
   ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL;

commit d63058b852b83515e7715103c04a684ecf59838a
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jan 7 12:44:55 2014 +0100

    Print the full PATH in the log if gpg was not found.
    
    * src/posix-util.c (walk_path): Keep a copy of PATH.

diff --git a/src/posix-util.c b/src/posix-util.c
index 5bfc486..1b92ec1 100644
--- a/src/posix-util.c
+++ b/src/posix-util.c
@@ -75,17 +75,18 @@ _gpgme_set_default_gpgconf_name (const char *name)
 static char *
 walk_path (const char *pgm)
 {
-  const char *path, *s;
+  const char *orig_path, *path, *s;
   char *fname, *p;
 
-  path = getenv ("PATH");
-  if (!path)
-    path = "/bin:/usr/bin:.";
+  orig_path = getenv ("PATH");
+  if (!orig_path)
+    orig_path = "/bin:/usr/bin:.";
 
-  fname = malloc (strlen (path) + 1 + strlen (pgm) + 1);
+  fname = malloc (strlen (orig_path) + 1 + strlen (pgm) + 1);
   if (!fname)
     return NULL;
 
+  path = orig_path;
   for (;;)
     {
       for (s=path, p=fname; *s && *s != ':'; s++, p++)
@@ -101,7 +102,7 @@ walk_path (const char *pgm)
     }
 
   _gpgme_debug (DEBUG_ENGINE, "gpgme-walk_path: '%s' not found in '%s'",
-                pgm, path);
+                pgm, orig_path);
 
   free (fname);
   return NULL;

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

Summary of changes:
 src/engine-backend.h |   12 ++++++++++++
 src/engine.c         |   40 ++++++++++++++++++++++++++++------------
 src/gpgconf.c        |   33 +--------------------------------
 src/gpgme.c          |    9 ++++++---
 src/posix-util.c     |   13 +++++++------
 5 files changed, 54 insertions(+), 53 deletions(-)


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




More information about the Gnupg-commits mailing list