[git] GPGME - branch, master, updated. gpgme-1.6.0-7-gbb2d11c

by Werner Koch cvs at cvs.gnupg.org
Wed Oct 28 16:34:17 CET 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 "GnuPG Made Easy".

The branch, master has been updated
       via  bb2d11c1eebd4bcfb0f2cfce728026a7420dca47 (commit)
       via  a82e9b182f62966207cad0972be6fa284329a5a1 (commit)
       via  bb600aa8fd2f9575ee7afc64c978e3e7523b1173 (commit)
      from  0d9d0a6b5b0c6f474a079bbaef11078c5df5f3b5 (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 bb2d11c1eebd4bcfb0f2cfce728026a7420dca47
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 28 16:27:49 2015 +0100

    w32: Add extra diagnostic about possible missing gpgme-w32spawn.exe.
    
    * src/w32-io.c (_gpgme_io_spawn): Add a new diagnostic.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/w32-io.c b/src/w32-io.c
index 42961e3..a6d5238 100644
--- a/src/w32-io.c
+++ b/src/w32-io.c
@@ -1550,6 +1550,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
   int debug_me = 0;
   int tmp_fd;
   char *tmp_name;
+  const char *spawnhelper;
 
   TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path,
 	      "path=%s", path);
@@ -1603,7 +1604,8 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
   if ((flags & IOSPAWN_FLAG_DETACHED))
     cr_flags |= DETACHED_PROCESS;
   cr_flags |= GetPriorityClass (GetCurrentProcess ());
-  if (!CreateProcessA (_gpgme_get_w32spawn_path (),
+  spawnhelper = _gpgme_get_w32spawn_path ();
+  if (!CreateProcessA (spawnhelper,
 		       arg_string,
 		       &sec_attr,     /* process security attributes */
 		       &sec_attr,     /* thread security attributes */
@@ -1614,7 +1616,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
 		       &si,           /* startup information */
 		       &pi))          /* returns process information */
     {
-      TRACE_LOG1 ("CreateProcess failed: ec=%d", (int) GetLastError ());
+      int lasterr = (int)GetLastError ();
+      TRACE_LOG1 ("CreateProcess failed: ec=%d", lasterr);
+      if (lasterr == ERROR_INVALID_PARAMETER)
+        TRACE_LOG1 ("(is '%s' correctly installed?)", spawnhelper);
       free (arg_string);
       close (tmp_fd);
       DeleteFileA (tmp_name);

commit a82e9b182f62966207cad0972be6fa284329a5a1
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 28 16:26:03 2015 +0100

    w32: Improve locating gpgconf on 64 bit systems.
    
    * src/w32-util.c (find_program_at_standard_place): Fallback to
    CSIDL_PROGRAM_FILESX86.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/w32-util.c b/src/w32-util.c
index f611b6c..3600b28 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -409,8 +409,13 @@ find_program_at_standard_place (const char *name)
   char path[MAX_PATH];
   char *result = NULL;
 
-  /* See http://wiki.tcl.tk/17492 for details on compatibility.  */
-  if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0))
+  /* See http://wiki.tcl.tk/17492 for details on compatibility.
+
+     We First try the generic place and then fallback to the x86
+     (i.e. 32 bit) place.  This will prefer a 64 bit of the program
+     over a 32 bit version on 64 bit Windows if installed.  */
+  if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0)
+      || SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0))
     {
       result = malloc (strlen (path) + 1 + strlen (name) + 1);
       if (result)

commit bb600aa8fd2f9575ee7afc64c978e3e7523b1173
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 28 16:24:30 2015 +0100

    w32: Add new global flag "w32-inst-dir".
    
    * src/gpgme.c (gpgme_set_global_flag): Add flag "w32-inst-dir";
    * src/posix-util.c (_gpgme_set_override_inst_dir): New stub.
    * src/w32-util.c (override_inst_dir): New var.
    (_gpgme_get_inst_dir): Return this var is set.
    (_gpgme_set_override_inst_dir): New.
    --
    
    See
    https://lists.gnupg.org/pipermail/gnupg-devel/2015-September/030267.html
    for background.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index a764ce4..1c680b5 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -701,6 +701,16 @@ directory part is used as the default installation directory; the
 @code{.exe} suffix is added by GPGME.  Use forward slashed even under
 Windows.
 
+ at item "w32-inst-dir"
+On Windows GPGME needs to know its installation directory to find its
+spawn helper.  This is in general no problem because a DLL has this
+information.  Some applications however link statically to GPGME and
+thus GPGME can only figure out the installation directory of this
+application which may be wrong in certain cases.  By supplying an
+installation directory as value to this flag, GPGME will assume that
+that directory is the installation directory.  This flag has no effect
+on non-Windows platforms.
+
 @end table
 
 This function returns @code{0} on success.  In contrast to other
diff --git a/src/gpgme.c b/src/gpgme.c
index 3c4e8e9..0b42ea1 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -75,6 +75,8 @@ gpgme_set_global_flag (const char *name, const char *value)
     return _gpgme_set_default_gpgconf_name (value);
   else if (!strcmp (name, "gpg-name"))
     return _gpgme_set_default_gpg_name (value);
+  else if (!strcmp (name, "w32-inst-dir"))
+    return _gpgme_set_override_inst_dir (value);
   else
     return -1;
 }
diff --git a/src/posix-util.c b/src/posix-util.c
index f7e0a17..0fce5c2 100644
--- a/src/posix-util.c
+++ b/src/posix-util.c
@@ -71,6 +71,15 @@ _gpgme_set_default_gpgconf_name (const char *name)
 }
 
 
+/* Dummy function - see w32-util.c for the actual code.  */
+int
+_gpgme_set_override_inst_dir (const char *dir)
+{
+  (void)dir;
+  return 0;
+}
+
+
 /* Find an executable program PGM along the envvar PATH.  */
 static char *
 walk_path (const char *pgm)
diff --git a/src/sys-util.h b/src/sys-util.h
index 589634b..541c557 100644
--- a/src/sys-util.h
+++ b/src/sys-util.h
@@ -23,6 +23,7 @@
 /*-- {posix,w32}-util.c --*/
 int _gpgme_set_default_gpg_name (const char *name);
 int _gpgme_set_default_gpgconf_name (const char *name);
+int _gpgme_set_override_inst_dir (const char *dir);
 
 char *_gpgme_get_gpg_path (void);
 char *_gpgme_get_gpgconf_path (void);
diff --git a/src/w32-util.c b/src/w32-util.c
index 9aba26f..f611b6c 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -85,7 +85,10 @@ static HMODULE my_hmodule;
    binaries.  The are set only once by gpgme_set_global_flag.  */
 static char *default_gpg_name;
 static char *default_gpgconf_name;
-
+/* If this variable is not NULL the value is assumed to be the
+   installation directory.  The variable may only be set once by
+   gpgme_set_global_flag and accessed by _gpgme_get_inst_dir.  */
+static char *override_inst_dir;
 
 #ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW
 
@@ -347,6 +350,9 @@ _gpgme_get_inst_dir (void)
 {
   static char *inst_dir;
 
+  if (override_inst_dir)
+    return override_inst_dir;
+
   LOCK (get_path_lock);
   if (!inst_dir)
     {
@@ -456,6 +462,28 @@ _gpgme_set_default_gpgconf_name (const char *name)
 }
 
 
+/* Set the override installation directory.  This function may only be
+   called by gpgme_set_global_flag.  Returns 0 on success.  */
+int
+_gpgme_set_override_inst_dir (const char *dir)
+{
+  if (!override_inst_dir)
+    {
+      override_inst_dir = malloc (strlen (dir) + 1);
+      if (override_inst_dir)
+        {
+          strcpy (override_inst_dir, dir);
+          replace_slashes (override_inst_dir);
+          /* Remove a trailing slash.  */
+          if (*override_inst_dir
+              && override_inst_dir[strlen (override_inst_dir)-1] == '\\')
+            override_inst_dir[strlen (override_inst_dir)-1] = 0;
+        }
+    }
+  return !override_inst_dir;
+}
+
+
 /* Return the full file name of the GPG binary.  This function is used
    iff gpgconf was not found and thus it can be assumed that gpg2 is
    not installed.  This function is only called by get_gpgconf_item

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

Summary of changes:
 doc/gpgme.texi   | 10 ++++++++++
 src/gpgme.c      |  2 ++
 src/posix-util.c |  9 +++++++++
 src/sys-util.h   |  1 +
 src/w32-io.c     |  9 +++++++--
 src/w32-util.c   | 39 ++++++++++++++++++++++++++++++++++++---
 6 files changed, 65 insertions(+), 5 deletions(-)


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




More information about the Gnupg-commits mailing list