summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-11-21 17:56:07 +0100
committerMilan Crha <mcrha@redhat.com>2012-11-21 17:56:07 +0100
commit01a2e2d8b769f3ce1bbf2eba83afbea765711197 (patch)
treee3e0df02e99e74fc91443c5b84368bd09acd9cfb
parente0904c3a41d04e41093b649fbc178eb1eb917215 (diff)
downloadevolution-data-server-01a2e2d8b769f3ce1bbf2eba83afbea765711197.tar.gz
Bug #687670 - Signing with both pgp and S/MIME causes a broken signature
-rw-r--r--camel/camel-cipher-context.c6
-rw-r--r--camel/camel-gpg-context.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index fa46bd674..04be06c89 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 4e9248824..b40271f60 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)