[Gpg4win-commits] [git] Gpg4win - branch, master, updated. gpg4win-2.1.1-50-gf3f751a

by Werner Koch cvs at cvs.gnupg.org
Mon Aug 12 15:29:48 CEST 2013


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 for Windows".

The branch, master has been updated
       via  f3f751a92543ee821621249333e89a8d311f77af (commit)
      from  b3201d93e757f2982e26c59c19089be312bdbc74 (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 f3f751a92543ee821621249333e89a8d311f77af
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Aug 12 15:01:36 2013 +0200

    Patch gpa to allow X.509 certificate import/export.
    
    * patches/gpa-0.9.4/02-x509-import.patch: New.
    * Makefile.am (EXTRA_DIST): Add patch.

diff --git a/Makefile.am b/Makefile.am
index 67cf925..47e2a11 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,7 +48,9 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/gtkhtml2_viewer-0.34/80-src-makefile.postcfg-build \
 	patches/gnutls-2.12.21/01-openssl-wincrypt.patch \
         patches/libgpg-error-1.12/01-fix-get-string.patch \
-	patches/gpa-0.9.4/01-bin-encrypt.patch
+	patches/gpa-0.9.4/01-bin-encrypt.patch \
+        patches/gpa-0.9.4/02-x509-import.patch
+
 
 copy-news:
 	cp NEWS doc/website/NEWS.last
diff --git a/patches/gpa-0.9.4/02-x509-import.patch b/patches/gpa-0.9.4/02-x509-import.patch
new file mode 100755
index 0000000..8891d8c
--- /dev/null
+++ b/patches/gpa-0.9.4/02-x509-import.patch
@@ -0,0 +1,288 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From 6742525110270b0098e41157edfb13e36483f1ca Mon Sep 17 00:00:00 2001
+From: Werner Koch <wk at gnupg.org>
+Date: Sat, 10 Aug 2013 08:34:38 +0200
+Subject: [PATCH] Allow import and export of X.509 certificates.
+
+* src/filetype.c (is_cms_data_ext): New.
+* src/gpaimportop.c (gpa_import_operation_idle_cb): Set the
+appropriate protocol.
+* src/gpaexportop.c (gpa_export_operation_idle_cb): Ditto.
+---
+ src/filetype.c    |   23 +++++++++++++++++++++++
+ src/filetype.h    |    1 +
+ src/gpaexportop.c |   41 +++++++++++++++++++++++++++++------------
+ src/gpaimportop.c |   26 +++++++++++++++-----------
+ 4 files changed, 68 insertions(+), 23 deletions(-)
+
+diff --git a/src/filetype.c b/src/filetype.c
+index 4e68d27..58b4145 100644
+--- a/src/filetype.c
++++ b/src/filetype.c
+@@ -200,3 +200,26 @@ is_cms_data (const char *data, size_t datalen)
+   return result;
+ #endif
+ }
++
++/* New version of is_cms_data which requires a decent version of
++   gpgme.  In contrast to is_cms_data this works directly on a gpgme
++   data object.  */
++int
++is_cms_data_ext (gpgme_data_t dh)
++{
++#ifdef HAVE_GPGME_DATA_IDENTIFY
++  switch (gpgme_data_identify (dh, 0))
++    {
++    case GPGME_DATA_TYPE_CMS_SIGNED:
++    case GPGME_DATA_TYPE_CMS_ENCRYPTED:
++    case GPGME_DATA_TYPE_CMS_OTHER:
++    case GPGME_DATA_TYPE_X509_CERT:
++    case GPGME_DATA_TYPE_PKCS12:
++      return 1;
++    default:
++      return 0;
++    }
++#else
++  return 0;
++#endif
++}
+diff --git a/src/filetype.h b/src/filetype.h
+index 6c88c68..8ba4c2e 100644
+--- a/src/filetype.h
++++ b/src/filetype.h
+@@ -20,6 +20,7 @@
+
+ int is_cms_file (const char *fname);
+ int is_cms_data (const char *data, size_t datalen);
++int is_cms_data_ext (gpgme_data_t dh);
+
+
+ #endif /*FILETYPE_H*/
+diff --git a/src/gpaexportop.c b/src/gpaexportop.c
+index 51df806..9caf49f 100644
+--- a/src/gpaexportop.c
++++ b/src/gpaexportop.c
+@@ -38,7 +38,7 @@ enum
+ static gboolean gpa_export_operation_idle_cb (gpointer data);
+ static void gpa_export_operation_done_cb (GpaContext *context, gpg_error_t err,
+			      GpaExportOperation *op);
+-static void gpa_export_operation_done_error_cb (GpaContext *context,
++static void gpa_export_operation_done_error_cb (GpaContext *context,
+						gpg_error_t err,
+						GpaExportOperation *op);
+
+@@ -97,7 +97,7 @@ gpa_export_operation_finalize (GObject *object)
+     {
+       gpgme_data_release (op->dest);
+     }
+-
++
+   G_OBJECT_CLASS (parent_class)->finalize (object);
+ }
+
+@@ -138,14 +138,14 @@ static void
+ gpa_export_operation_class_init (GpaExportOperationClass *klass)
+ {
+   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+-
++
+   parent_class = g_type_class_peek_parent (klass);
+
+   object_class->constructor = gpa_export_operation_constructor;
+   object_class->finalize = gpa_export_operation_finalize;
+   object_class->set_property = gpa_export_operation_set_property;
+   object_class->get_property = gpa_export_operation_get_property;
+-
++
+   /* Virtual methods */
+   klass->get_destination = NULL;
+   klass->complete_export = NULL;
+@@ -153,7 +153,7 @@ gpa_export_operation_class_init (GpaExportOperationClass *klass)
+   /* Properties */
+   g_object_class_install_property (object_class,
+				   PROP_KEYS,
+-				   g_param_spec_pointer
++				   g_param_spec_pointer
+				   ("keys", "Keys",
+				    "Keys",
+				    G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
+@@ -163,7 +163,7 @@ GType
+ gpa_export_operation_get_type (void)
+ {
+   static GType file_operation_type = 0;
+-
++
+   if (!file_operation_type)
+     {
+       static const GTypeInfo file_operation_info =
+@@ -178,12 +178,12 @@ gpa_export_operation_get_type (void)
+         0,              /* n_preallocs */
+         (GInstanceInitFunc) gpa_export_operation_init,
+       };
+-
++
+       file_operation_type = g_type_register_static (GPA_OPERATION_TYPE,
+						    "GpaExportOperation",
+						    &file_operation_info, 0);
+     }
+-
++
+   return file_operation_type;
+ }
+
+@@ -198,10 +198,11 @@ gpa_export_operation_idle_cb (gpointer data)
+   if (GPA_EXPORT_OPERATION_GET_CLASS (op)->get_destination (op, &op->dest,
+							    &armor))
+     {
+-      gpg_error_t err;
++      gpg_error_t err = 0;
+       const char **patterns;
+       GList *k;
+       int i;
++      gpgme_protocol_t prot = GPGME_PROTOCOL_UNKNOWN;
+
+       gpgme_set_armor (GPA_OPERATION (op)->context->ctx, armor);
+       /* Create the set of keys to export */
+@@ -210,17 +211,33 @@ gpa_export_operation_idle_cb (gpointer data)
+	{
+	  gpgme_key_t key = (gpgme_key_t) k->data;
+	  patterns[i] = key->subkeys->fpr;
++          if (prot == GPGME_PROTOCOL_UNKNOWN)
++            prot = key->protocol;
++          else if (prot != key->protocol)
++            {
++              gpa_window_error
++                (_("Only keys of the same procotol may be exported"
++                   " as a collection."), NULL);
++              g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
++              goto cleanup;
++            }
+	}
++      if (prot == GPGME_PROTOCOL_UNKNOWN)
++        {
++          g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
++          goto cleanup;  /* No keys.  */
++        }
++      gpgme_set_protocol (GPA_OPERATION (op)->context->ctx, prot);
+       /* Export to the gpgme_data_t */
+-      err = gpgme_op_export_ext_start (GPA_OPERATION (op)->context->ctx,
++      err = gpgme_op_export_ext_start (GPA_OPERATION (op)->context->ctx,
+				       patterns, 0, op->dest);
+       if (err)
+	{
+	  gpa_gpgme_warning (err);
+	  g_signal_emit_by_name (GPA_OPERATION (op), "completed", err);
+	}
+-      /* Clean up */
+-      g_free (patterns);
++    cleanup:
++      g_free (patterns);
+     }
+   else
+     /* Abort the operation.  */
+diff --git a/src/gpaimportop.c b/src/gpaimportop.c
+index 81ed769..0680a21 100644
+--- a/src/gpaimportop.c
++++ b/src/gpaimportop.c
+@@ -25,6 +25,7 @@
+ #include "i18n.h"
+ #include "gtktools.h"
+ #include "gpaimportop.h"
++#include "filetype.h"
+
+ static GObjectClass *parent_class = NULL;
+
+@@ -40,7 +41,7 @@ static guint signals [LAST_SIGNAL] = { 0 };
+ static gboolean gpa_import_operation_idle_cb (gpointer data);
+ static void gpa_import_operation_done_cb (GpaContext *context, gpg_error_t err,
+			      GpaImportOperation *op);
+-static void gpa_import_operation_done_error_cb (GpaContext *context,
++static void gpa_import_operation_done_error_cb (GpaContext *context,
+						gpg_error_t err,
+						GpaImportOperation *op);
+
+@@ -56,7 +57,7 @@ gpa_import_operation_finalize (GObject *object)
+     {
+       gpgme_data_release (op->source);
+     }
+-
++
+   G_OBJECT_CLASS (parent_class)->finalize (object);
+ }
+
+@@ -95,12 +96,12 @@ static void
+ gpa_import_operation_class_init (GpaImportOperationClass *klass)
+ {
+   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+-
++
+   parent_class = g_type_class_peek_parent (klass);
+
+   object_class->constructor = gpa_import_operation_constructor;
+   object_class->finalize = gpa_import_operation_finalize;
+-
++
+   /* Virtual methods */
+   klass->get_source = NULL;
+   klass->complete_import = NULL;
+@@ -130,7 +131,7 @@ GType
+ gpa_import_operation_get_type (void)
+ {
+   static GType file_operation_type = 0;
+-
++
+   if (!file_operation_type)
+     {
+       static const GTypeInfo file_operation_info =
+@@ -145,12 +146,12 @@ gpa_import_operation_get_type (void)
+         0,              /* n_preallocs */
+         (GInstanceInitFunc) gpa_import_operation_init,
+       };
+-
++
+       file_operation_type = g_type_register_static (GPA_OPERATION_TYPE,
+						    "GpaImportOperation",
+						    &file_operation_info, 0);
+     }
+-
++
+   return file_operation_type;
+ }
+
+@@ -164,7 +165,10 @@ gpa_import_operation_idle_cb (gpointer data)
+   if (GPA_IMPORT_OPERATION_GET_CLASS (op)->get_source (op, &op->source))
+     {
+       gpg_error_t err;
+-
++
++      gpgme_set_protocol (GPA_OPERATION (op)->context->ctx,
++                          is_cms_data_ext (op->source)?
++                          GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP);
+       err = gpgme_op_import_start (GPA_OPERATION (op)->context->ctx,
+				   op->source);
+       if (err)
+@@ -181,8 +185,8 @@ gpa_import_operation_idle_cb (gpointer data)
+   return FALSE;
+ }
+
+-static void
+-key_import_results_dialog_run (GtkWidget *parent,
++static void
++key_import_results_dialog_run (GtkWidget *parent,
+			       gpgme_import_result_t info)
+ {
+   GtkWidget *dialog;
+@@ -211,7 +215,7 @@ key_import_results_dialog_run (GtkWidget *parent,
+                                        info->unchanged, info->secret_read,
+                                        info->secret_imported,
+				       info->secret_unchanged);
+-    }
++    }
+
+   /* Run the dialog */
+   gtk_widget_show_all (dialog);
+--
+1.7.7.1

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

Summary of changes:
 Makefile.am                            |    4 +-
 patches/gpa-0.9.4/02-x509-import.patch |  288 ++++++++++++++++++++++++++++++++
 2 files changed, 291 insertions(+), 1 deletions(-)
 create mode 100755 patches/gpa-0.9.4/02-x509-import.patch


hooks/post-receive
-- 
GnuPG for Windows
http://git.gnupg.org



More information about the Gpg4win-commits mailing list