gpgme/gpgme-1.1.6-from-upstream.patch

207 lines
6.1 KiB
Diff

--- gpgme-1.1.6/gpgme/ChangeLog
+++ gpgme-r1301/gpgme/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-28 Werner Koch <wk@g10code.com>
+
+ * keylist.c (gpgme_get_key): Skip duplicated keys. Fixes bug 876.
+
+2008-01-14 Marcus Brinkmann <marcus@g10code.de>
+
+ * engine-gpgconf.c (gpgconf_config_load_cb): Fix program_name
+ field.
+
2008-01-04 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (gpgconf_components): New variable.
--- gpgme-1.1.6/gpgme/engine-gpgconf.c
+++ gpgme-r1301/gpgme/engine-gpgconf.c
@@ -313,8 +310,8 @@ gpgconf_config_load_cb (void *hook, char
if (fields >= 3)
{
- comp->description = strdup (field[2]);
- if (!comp->description)
+ comp->program_name = strdup (field[2]);
+ if (!comp->program_name)
return gpg_error_from_syserror ();
}
@@ -457,9 +454,18 @@ gpgconf_config_load_cb2 (void *hook, cha
return gpg_error_from_syserror ();
}
- err = gpgconf_parse_option (opt, &opt->no_arg_value, field[8]);
- if (err)
- return err;
+ if (opt->flags & GPGME_CONF_NO_ARG_DESC)
+ {
+ opt->no_arg_description = strdup (field[8]);
+ if (!opt->no_arg_description)
+ return gpg_error_from_syserror ();
+ }
+ else
+ {
+ err = gpgconf_parse_option (opt, &opt->no_arg_value, field[8]);
+ if (err)
+ return err;
+ }
err = gpgconf_parse_option (opt, &opt->value, field[9]);
if (err)
--- gpgme-1.1.6/gpgme/keylist.c
+++ gpgme-r1301/gpgme/keylist.c
@@ -964,11 +964,26 @@ gpgme_get_key (gpgme_ctx_t ctx, const ch
err = gpgme_op_keylist_next (listctx, r_key);
if (!err)
{
+ try_next_key:
err = gpgme_op_keylist_next (listctx, &key);
if (gpgme_err_code (err) == GPG_ERR_EOF)
- err = gpg_error (GPG_ERR_NO_ERROR);
+ err = 0;
else
{
+ if (!err
+ && *r_key && (*r_key)->subkeys && (*r_key)->subkeys->fpr
+ && key && key->subkeys && key->subkeys->fpr
+ && !strcmp ((*r_key)->subkeys->fpr, key->subkeys->fpr))
+ {
+ /* The fingerprint is identical. We assume that this is
+ the same key and don't mark it as an ambiguous. This
+ problem may occur with corrupted keyrings and has
+ been noticed often with gpgsm. In fact gpgsm uses a
+ similar hack to sort out such duplicates but it can't
+ do that while listing keys. */
+ gpgme_key_unref (key);
+ goto try_next_key;
+ }
if (!err)
{
gpgme_key_unref (key);
--- gpgme-1.1.6/tests/ChangeLog
+++ gpgme-r1301/tests/ChangeLog
@@ -1,3 +1,20 @@
+2008-01-28 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpg/Makefile.am (DISTCLEANFILES): Add pubring.kbx~.
+
+2008-01-10 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpg/t-gpgconf.c (main): Allow for dirmngr not to be available.
+
+ * gpg/Makefile.am (./gpg-agent.conf): Correct pinentry path.
+
+ * gpg/pinentry: New file.
+ * gpg/Makefile.am (DISTCLEANFILES, all-local): Add gpg-agent.conf
+ (./gpg-agent.conf): New target.
+ (EXTRA_DIST): Add pinentry.
+
+ * gpg/t-gpgconf.c (main): Exit early if compiled without gpgconf.
+
2008-01-04 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (CLEANFILES): Add pubring.kbx and dirmngr.conf.
--- gpgme-1.1.6/tests/gpg/Makefile.am
+++ gpgme-r1301/tests/gpg/Makefile.am
@@ -38,10 +38,10 @@ TESTS = t-encrypt t-encrypt-sym t-encryp
t-encrypt-large t-file-name t-gpgconf $(tests_unix)
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf
-DISTCLEANFILES = pubring.gpg~ random_seed gpg.conf
+DISTCLEANFILES = pubring.gpg~ pubring.kbx~ random_seed gpg.conf gpg-agent.conf
EXTRA_DIST = mkdemodirs pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
- geheim.txt pubkey-1.asc seckey-1.asc
+ geheim.txt pubkey-1.asc seckey-1.asc pinentry
INCLUDES = -I$(top_srcdir)/gpgme
@@ -55,7 +55,7 @@ noinst_PROGRAMS = $(TESTS) t-genkey
clean-local:
$(srcdir)/mkdemodirs --clean
-all-local: ./pubring.gpg ./gpg.conf
+all-local: ./pubring.gpg ./gpg.conf ./gpg-agent.conf
./pubring.gpg: $(srcdir)/pubdemo.asc ./Alpha/Secret.gpg
$(GPG) --homedir . --import $(srcdir)/pubdemo.asc
@@ -68,3 +68,7 @@ all-local: ./pubring.gpg ./gpg.conf
./gpg.conf:
# This is required for t-sig-notations.
echo no-force-v3-sigs > ./gpg.conf
+
+./gpg-agent.conf:
+# This is required for gpg2, which does not support command fd.
+ echo pinentry-program $(abs_srcdir)/pinentry > ./gpg-agent.conf
--- gpgme-1.1.6/tests/gpg/pinentry
+++ gpgme-r1301/tests/gpg/pinentry
@@ -0,0 +1,22 @@
+#! /bin/bash
+# Dummy pinentry
+#
+# Copyright 2008 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE.
+
+echo OK Your orders please
+
+while read cmd; do
+ case $cmd in
+ GETPIN) echo D abc; echo OK;;
+ *) echo OK;;
+ esac
+done
--- gpgme-1.1.6/tests/gpg/t-gpgconf.c
+++ gpgme-r1301/tests/gpg/t-gpgconf.c
@@ -254,6 +254,11 @@ main (int argc, char **argv)
gpgme_conf_comp_t conf;
gpgme_conf_comp_t comp;
int first;
+
+#ifndef ENABLE_GPGCONF
+ return 0;
+#endif
+
init_gpgme (GPGME_PROTOCOL_GPGCONF);
err = gpgme_new (&ctx);
@@ -287,15 +292,23 @@ main (int argc, char **argv)
comp = conf;
while (comp && strcmp (comp->name, "dirmngr"))
comp = comp->next;
- opt = comp->options;
- while (opt && strcmp (opt->name, "verbose"))
- opt = opt->next;
- err = gpgme_conf_opt_change (opt, 0, arg);
- fail_if_err (err);
-
- err = gpgme_op_conf_save (ctx, comp);
- fail_if_err (err);
+ if (comp)
+ {
+ opt = comp->options;
+ while (opt && strcmp (opt->name, "verbose"))
+ opt = opt->next;
+
+ /* Allow for the verbose option not to be there. */
+ if (opt)
+ {
+ err = gpgme_conf_opt_change (opt, 0, arg);
+ fail_if_err (err);
+
+ err = gpgme_op_conf_save (ctx, comp);
+ fail_if_err (err);
+ }
+ }
}
#endif