[evolution-data-server] Bug #687670 - Signing with both pgp and S/MIME causes a broken signature



commit b245b5be15b3170811bff46601ba8c2a7cb69626
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 21 17:55:15 2012 +0100

    Bug #687670 - Signing with both pgp and S/MIME causes a broken signature

 camel/camel-cipher-context.c |    6 ++++++
 camel/camel-gpg-context.c    |   11 +++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index e7be3ac..a864b15 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -37,6 +37,8 @@
 #include "camel-mime-utils.h"
 #include "camel-medium.h"
 #include "camel-multipart.h"
+#include "camel-multipart-encrypted.h"
+#include "camel-multipart-signed.h"
 #include "camel-mime-message.h"
 #include "camel-mime-filter-canon.h"
 #include "camel-stream-filter.h"
@@ -1814,6 +1816,10 @@ cc_prepare_sign (CamelMimePart *part)
 	if (!dw)
 		return;
 
+	/* should not change encoding for these, they have the right encoding set already */
+	if (CAMEL_IS_MULTIPART_SIGNED (dw) || CAMEL_IS_MULTIPART_ENCRYPTED (dw))
+		return;
+
 	if (CAMEL_IS_MULTIPART (dw)) {
 		parts = camel_multipart_get_number ((CamelMultipart *) dw);
 		for (i = 0; i < parts; i++)
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 4e92488..b40271f 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -1409,6 +1409,7 @@ swrite (CamelMimePart *sigpart,
         GError **error)
 {
 	CamelStream *ostream;
+	CamelDataWrapper *wrapper;
 	gchar *template;
 	gint fd, ret;
 
@@ -1418,11 +1419,13 @@ swrite (CamelMimePart *sigpart,
 		return NULL;
 	}
 
-	/* TODO: This should probably just write the decoded message content out, not the part + headers */
-
 	ostream = camel_stream_fs_new_with_fd (fd);
-	ret = camel_data_wrapper_write_to_stream_sync (
-		CAMEL_DATA_WRAPPER (sigpart), ostream, cancellable, error);
+	wrapper = camel_medium_get_content (CAMEL_MEDIUM (sigpart));
+	if (!wrapper)
+		wrapper = CAMEL_DATA_WRAPPER (sigpart);
+
+	ret = camel_data_wrapper_decode_to_stream_sync (
+		wrapper, ostream, cancellable, error);
 	if (ret != -1) {
 		ret = camel_stream_flush (ostream, cancellable, error);
 		if (ret != -1)



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