gpa: Add patches to fix card key generation.
authorWerner Koch <wk@gnupg.org>
Mon, 19 Aug 2013 19:09:39 +0000 (21:09 +0200)
committerWerner Koch <wk@gnupg.org>
Mon, 19 Aug 2013 19:09:39 +0000 (21:09 +0200)
* patches/gpa-0.9.4/05-event-done.patch: New.
* patches/gpgme-1.4.3/01-card-edit.patch: New.
* Makefile.am (EXTRA_DIST): Add patches.

Makefile.am
patches/gpa-0.9.4/05-event-done.patch [new file with mode: 0755]
patches/gpgme-1.4.3/01-card-edit.patch [new file with mode: 0755]

index 14cd582..fec6ec4 100644 (file)
@@ -54,7 +54,9 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/gpa-0.9.4/02-cms-detection.patch \
         patches/gpa-0.9.4/02-x509-import.patch \
         patches/gpa-0.9.4/03-homedir-via-gpgconf.patch \
-        patches/gpa-0.9.4/04-utf-clip-crash.patch
+        patches/gpa-0.9.4/04-utf-clip-crash.patch \
+        patches/gpa-0.9.4/05-event-done.patch \
+       patches/gpgme-1.4.3/01-card-edit.patch
 
 copy-news:
        cp NEWS doc/website/NEWS.last
diff --git a/patches/gpa-0.9.4/05-event-done.patch b/patches/gpa-0.9.4/05-event-done.patch
new file mode 100755 (executable)
index 0000000..a9c68c2
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From 45eb36a00e0bb39fd02cb065e79cbc53945e7103 Mon Sep 17 00:00:00 2001
+From: Werner Koch <wk@gnupg.org>
+Date: Mon, 19 Aug 2013 20:29:25 +0200
+Subject: [PATCH] Fix wrong use of GPGME_EVENT_DONE.
+
+* src/gpacontext.c (gpa_context_event_cb): Fix use of TYPE_DATA.  Add
+debug output.
+--
+
+With GPGME commit c8e934b2 (2009-10-26) gpgme_io_event_done_data_t was
+introduced to replace the use of gpg_error_t with GPGME_EVENT_DONE.
+Unfortunately this was not documented.  Maybe at that time the event
+code was considered internal and its use in GPA was not known.  Too
+bad.
+---
+ src/gpacontext.c |   13 +++++++++----
+ 1 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/gpacontext.c b/src/gpacontext.c
+index e021d5f..b049f84 100644
+--- a/src/gpacontext.c
++++ b/src/gpacontext.c
+@@ -405,16 +405,21 @@ static void
+ gpa_context_event_cb (void *data, gpgme_event_io_t type, void *type_data)
+ {
+   GpaContext *context = data;
+-  gpg_error_t *err;
+-
++  gpg_error_t err, op_err;
++
+   switch (type)
+     {
+     case GPGME_EVENT_START:
+       g_signal_emit (context, signals[START], 0);
+       break;
+     case GPGME_EVENT_DONE:
+-      err = type_data;
+-      g_signal_emit (context, signals[DONE], 0, *err);
++      err = ((gpgme_io_event_done_data_t)type_data)->err;
++      op_err = ((gpgme_io_event_done_data_t)type_data)->op_err;
++      g_debug ("EVENT_DONE: err=%s op_err=%s",
++               gpg_strerror (err), gpg_strerror (op_err));
++      if (!err)
++        err = op_err;
++      g_signal_emit (context, signals[DONE], 0, err);
+       break;
+     case GPGME_EVENT_NEXT_KEY:
+       g_signal_emit (context, signals[NEXT_KEY], 0, type_data);
+--
+1.7.7.1
diff --git a/patches/gpgme-1.4.3/01-card-edit.patch b/patches/gpgme-1.4.3/01-card-edit.patch
new file mode 100755 (executable)
index 0000000..b0ab3fc
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From 372bd439834c69d502668007c8c683233d676bd5 Mon Sep 17 00:00:00 2001
+From: Werner Koch <wk@gnupg.org>
+Date: Mon, 19 Aug 2013 20:40:10 +0200
+Subject: Fix possible segv in the gpgme_op_card_edit.
+
+* src/edit.c (gpgme_op_edit_start, gpgme_op_card_edit_start): Do not
+deref a NULL KEY in TRACE_BEG.
+---
+ src/edit.c |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/edit.c b/src/edit.c
+index 1f73078..72fa458 100644
+--- a/src/edit.c
++++ b/src/edit.c
+@@ -143,7 +143,7 @@ gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
+
+   TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit_start", ctx,
+             "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
+-            (key->subkeys && key->subkeys->fpr) ?
++            (key && key->subkeys && key->subkeys->fpr) ?
+             key->subkeys->fpr : "invalid", fnc, fnc_value, out);
+
+   if (!ctx)
+@@ -164,7 +164,7 @@ gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,
+
+   TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit", ctx,
+             "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
+-            (key->subkeys && key->subkeys->fpr) ?
++            (key && key->subkeys && key->subkeys->fpr) ?
+             key->subkeys->fpr : "invalid", fnc, fnc_value, out);
+
+   if (!ctx)
+@@ -187,7 +187,7 @@ gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
+
+   TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit_start", ctx,
+             "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
+-            (key->subkeys && key->subkeys->fpr) ?
++            (key && key->subkeys && key->subkeys->fpr) ?
+             key->subkeys->fpr : "invalid", fnc, fnc_value, out);
+
+   if (!ctx)
+@@ -208,7 +208,7 @@ gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key,
+
+   TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit", ctx,
+             "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
+-            (key->subkeys && key->subkeys->fpr) ?
++            (key && key->subkeys && key->subkeys->fpr) ?
+             key->subkeys->fpr : "invalid", fnc, fnc_value, out);
+
+   if (!ctx)
+--
+1.7.7.1