[gmime] Include gmime-pkcs7-context.h in gmime.h



commit 20b8c962e15685e397e739ca30b44b86b0589760
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Wed Jun 13 20:46:41 2012 -0400

    Include gmime-pkcs7-context.h in gmime.h
    
    2012-06-13  Jeffrey Stedfast  <fejj gnome org>
    
    	* gmime/Makefile.am: Always build gmime-gpg-context.[c,h] and
    	gmime-pkcs7-context.[c,h]
    
    	* gmime/gmime-gpg-context.c: Armor internals with #ifdef
    	ENABLE_CRYPTOGRAPHY so that if crypto is disabled, only the
    	skeletal API is built.
    
    	* gmime/gmime.h: Include gmime-pkcs7-context.h
    
    	Fixes bug #676692.

 ChangeLog                 |   13 +++++++++++++
 gmime/Makefile.am         |   16 ++++------------
 gmime/gmime-gpg-context.c |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 gmime/gmime-version.h.in  |    2 +-
 gmime/gmime.h             |    1 +
 5 files changed, 63 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5bc4d3e..46e7f66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2012-06-13  Jeffrey Stedfast  <fejj gnome org>
 
+	* gmime/Makefile.am: Always build gmime-gpg-context.[c,h] and
+	gmime-pkcs7-context.[c,h]
+
+	* gmime/gmime-gpg-context.c: Armor internals with #ifdef
+	ENABLE_CRYPTOGRAPHY so that if crypto is disabled, only the
+	skeletal API is built.
+
+	* gmime/gmime.h: Include gmime-pkcs7-context.h
+
+	Fixes bug #676692.
+
+2012-06-13  Jeffrey Stedfast  <fejj gnome org>
+
 	* gmime/gmime-utils.c (rfc2047_encode_get_rfc822_words): Use
 	is_blank() instead of is_lwsp() so that we only treat space and
 	tab as word delimiters (we want to rfc2047 encode \r's and
diff --git a/gmime/Makefile.am b/gmime/Makefile.am
index 95db7b2..a67e90d 100644
--- a/gmime/Makefile.am
+++ b/gmime/Makefile.am
@@ -41,6 +41,7 @@ libgmime_2_6_la_SOURCES = 		\
 	gmime-filter-strip.c		\
 	gmime-filter-windows.c		\
 	gmime-filter-yenc.c		\
+	gmime-gpg-context.c		\
 	gmime-header.c			\
 	gmime-iconv.c			\
 	gmime-iconv-utils.c		\
@@ -56,6 +57,7 @@ libgmime_2_6_la_SOURCES = 		\
 	gmime-parser.c			\
 	gmime-part.c			\
 	gmime-part-iter.c		\
+	gmime-pkcs7-context.c		\
 	gmime-signature.c		\
 	gmime-stream.c			\
 	gmime-stream-buffer.c		\
@@ -71,12 +73,6 @@ libgmime_2_6_la_SOURCES = 		\
 	gmime-utils.c			\
 	internet-address.c
 
-if ENABLE_CRYPTOGRAPHY
-libgmime_2_6_la_SOURCES += 		\
-	gmime-gpg-context.c		\
-	gmime-pkcs7-context.c
-endif
-
 gmimeinclude_HEADERS = 			\
 	gmime.h				\
 	gmime-certificate.h		\
@@ -100,6 +96,7 @@ gmimeinclude_HEADERS = 			\
 	gmime-filter-strip.h		\
 	gmime-filter-windows.h		\
 	gmime-filter-yenc.h		\
+	gmime-gpg-context.h		\
 	gmime-header.h			\
 	gmime-iconv.h			\
 	gmime-iconv-utils.h		\
@@ -114,6 +111,7 @@ gmimeinclude_HEADERS = 			\
 	gmime-parser.h			\
 	gmime-part.h			\
 	gmime-part-iter.h		\
+	gmime-pkcs7-context.h		\
 	gmime-signature.h		\
 	gmime-stream.h			\
 	gmime-stream-buffer.h		\
@@ -130,12 +128,6 @@ gmimeinclude_HEADERS = 			\
 	gmime-version.h			\
 	internet-address.h
 
-if ENABLE_CRYPTOGRAPHY
-gmimeinclude_HEADERS +=			\
-	gmime-gpg-context.h		\
-	gmime-pkcs7-context.h
-endif
-
 noinst_HEADERS = 			\
 	gmime-charset-map-private.h	\
 	gmime-table-private.h		\
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 853b553..78d2e57 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -48,12 +48,14 @@ typedef unsigned int nfds_t;
 #endif
 
 #include "gmime-gpg-context.h"
+#ifdef ENABLE_CRYPTOGRAPHY
 #include "gmime-filter-charset.h"
 #include "gmime-stream-filter.h"
 #include "gmime-stream-pipe.h"
 #include "gmime-stream-mem.h"
 #include "gmime-stream-fs.h"
 #include "gmime-charset.h"
+#endif /* ENABLE_CRYPTOGRAPHY */
 #include "gmime-error.h"
 
 #ifdef ENABLE_DEBUG
@@ -266,6 +268,7 @@ gpg_get_key_exchange_protocol (GMimeCryptoContext *ctx)
 	return "application/pgp-keys";
 }
 
+#ifdef ENABLE_CRYPTOGRAPHY
 enum _GpgCtxMode {
 	GPG_CTX_MODE_SIGN,
 	GPG_CTX_MODE_VERIFY,
@@ -1806,12 +1809,13 @@ gpg_ctx_op_wait (struct _GpgCtx *gpg)
 	else
 		return -1;
 }
-
+#endif /* ENABLE_CRYPTOGRAPHY */
 
 static int
 gpg_sign (GMimeCryptoContext *context, const char *userid, GMimeDigestAlgo digest,
 	  GMimeStream *istream, GMimeStream *ostream, GError **err)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	struct _GpgCtx *gpg;
 	
@@ -1862,6 +1866,11 @@ gpg_sign (GMimeCryptoContext *context, const char *userid, GMimeDigestAlgo diges
 	gpg_ctx_free (gpg);
 	
 	return digest;
+#else
+	g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this build"));
+	
+	return -1;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 
@@ -1870,6 +1879,7 @@ gpg_verify (GMimeCryptoContext *context, GMimeDigestAlgo digest,
 	    GMimeStream *istream, GMimeStream *sigstream,
 	    GError **err)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	GMimeSignatureList *signatures;
 	struct _GpgCtx *gpg;
@@ -1917,6 +1927,11 @@ gpg_verify (GMimeCryptoContext *context, GMimeDigestAlgo digest,
 	gpg_ctx_free (gpg);
 	
 	return signatures;
+#else
+	g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this build"));
+	
+	return NULL;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 
@@ -1925,6 +1940,7 @@ gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
 	     GMimeDigestAlgo digest, GPtrArray *recipients, GMimeStream *istream,
 	     GMimeStream *ostream, GError **err)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	struct _GpgCtx *gpg;
 	guint i;
@@ -1982,6 +1998,11 @@ gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
 	gpg_ctx_free (gpg);
 	
 	return 0;
+#else
+	g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this build"));
+	
+	return -1;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 
@@ -1989,6 +2010,7 @@ static GMimeDecryptResult *
 gpg_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
 	     GMimeStream *ostream, GError **err)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	GMimeDecryptResult *result;
 	const char *diagnostics;
@@ -2041,11 +2063,17 @@ gpg_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
 	gpg_ctx_free (gpg);
 	
 	return result;
+#else
+	g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this build"));
+	
+	return NULL;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 static int
 gpg_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	struct _GpgCtx *gpg;
 	
@@ -2088,11 +2116,17 @@ gpg_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err
 	gpg_ctx_free (gpg);
 	
 	return 0;
+#else
+	g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this build"));
+	
+	return -1;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 static int
 gpg_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	struct _GpgCtx *gpg;
 	guint i;
@@ -2141,6 +2175,11 @@ gpg_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostr
 	gpg_ctx_free (gpg);
 	
 	return 0;
+#else
+	g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this build"));
+	
+	return -1;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 
@@ -2156,6 +2195,7 @@ gpg_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostr
 GMimeCryptoContext *
 g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *path)
 {
+#ifdef ENABLE_CRYPTOGRAPHY
 	GMimeCryptoContext *crypto;
 	GMimeGpgContext *ctx;
 	
@@ -2168,6 +2208,9 @@ g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *pat
 	crypto->request_passwd = request_passwd;
 	
 	return crypto;
+#else
+	return NULL;
+#endif /* ENABLE_CRYPTOGRAPHY */
 }
 
 
diff --git a/gmime/gmime-version.h.in b/gmime/gmime-version.h.in
index 1dd3db1..5c5a785 100644
--- a/gmime/gmime-version.h.in
+++ b/gmime/gmime-version.h.in
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*  GMime
- *  Copyright (C) 2000-2009 Jeffrey Stedfast
+ *  Copyright (C) 2000-2012 Jeffrey Stedfast
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public License
diff --git a/gmime/gmime.h b/gmime/gmime.h
index 97b9bd3..6b97b6e 100644
--- a/gmime/gmime.h
+++ b/gmime/gmime.h
@@ -70,6 +70,7 @@
 #include <gmime/gmime-filter-windows.h>
 #include <gmime/gmime-filter-yenc.h>
 #include <gmime/gmime-crypto-context.h>
+#include <gmime/gmime-pkcs7-context.h>
 #include <gmime/gmime-gpg-context.h>
 
 G_BEGIN_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]