Add patch for gpgme gpgconf fallback search
authorAndre Heinecke <aheinecke@intevation.de>
Wed, 2 Mar 2016 10:27:08 +0000 (11:27 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Wed, 2 Mar 2016 10:27:08 +0000 (11:27 +0100)
* patches/gpgme-1.6.0/
 0001-w32-Fallback-to-2.1-reg-key-for-gpgconf-search.patch: New.

patches/gpgme-1.6.0/0001-w32-Fallback-to-2.1-reg-key-for-gpgconf-search.patch [new file with mode: 0755]

diff --git a/patches/gpgme-1.6.0/0001-w32-Fallback-to-2.1-reg-key-for-gpgconf-search.patch b/patches/gpgme-1.6.0/0001-w32-Fallback-to-2.1-reg-key-for-gpgconf-search.patch
new file mode 100755 (executable)
index 0000000..52a5cf0
--- /dev/null
@@ -0,0 +1,55 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From bd8d559f2c0cc76d32c3668f70da5d9f1831cbc1 Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke@intevation.de>
+Date: Tue, 1 Mar 2016 13:11:13 +0100
+Subject: [PATCH] w32: Fallback to 2.1 reg key for gpgconf search
+
+* src/w32-util.c (_gpgme_get_gpgconf_path): Fallback to 2.1 installer
+ registry key.
+
+--
+Finding gpgconf is utterly important so we should be as compatible
+as possible.
+---
+ src/w32-util.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/src/w32-util.c b/src/w32-util.c
+index a27955b..0086fe3 100644
+--- a/src/w32-util.c
++++ b/src/w32-util.c
+@@ -563,15 +563,26 @@ _gpgme_get_gpgconf_path (void)
+       gpgconf = find_program_at_standard_place (name2);
+     }
+
+-  /* 3. Try to find gpgconf.exe using that ancient registry key.  This
+-        should eventually be removed.  */
++  /* 3. Try to find gpgconf.exe using the Windows registry. */
+   if (!gpgconf)
+     {
+       char *dir;
+
+-      dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
++      dir = read_w32_registry_string (NULL,
+                                       "Software\\GNU\\GnuPG",
+                                       "Install Directory");
++      if (!dir)
++        {
++          char *tmp = read_w32_registry_string (NULL,
++                                                "Software\\GnuPG",
++                                                "Install Directory");
++          if (tmp)
++            {
++              if (gpgrt_asprintf (&dir, "%s\\bin", tmp) == -1)
++                return NULL;
++              free (tmp);
++            }
++        }
+       if (dir)
+         {
+           gpgconf = find_program_in_dir (dir, name);
+--
+2.1.4