Fix for bug #69241.

2004-11-08  Jeffrey Stedfast  <fejj@novell.com>

	Fix for bug #69241.

	* camel-gpg-context.c (gpg_decrypt): We need to extract just the
	application/pgp-encrypted part from the multipart/encrypted that
	gets passed in. Added checks to verify that the input part is the
	correct type as well. Once we have the application/pgp-encrypted
	part, we need to use camel_data_wrapper_decode_to_stream() in case
	the part was encoded in any way.

svn path=/trunk/; revision=27876
This commit is contained in:
Jeffrey Stedfast
2004-11-09 17:10:26 +00:00
committed by Jeffrey Stedfast
parent df5bede1f4
commit eebf9be695
2 changed files with 27 additions and 10 deletions

View File

@ -1,3 +1,14 @@
2004-11-08 Jeffrey Stedfast <fejj@novell.com>
Fix for bug #69241.
* camel-gpg-context.c (gpg_decrypt): We need to extract just the
application/pgp-encrypted part from the multipart/encrypted that
gets passed in. Added checks to verify that the input part is the
correct type as well. Once we have the application/pgp-encrypted
part, we need to use camel_data_wrapper_decode_to_stream() in case
the part was encoded in any way.
2004-11-09 Jeffrey Stedfast <fejj@novell.com>
* providers/imap4/camel-imap4-stream.c (camel_imap4_stream_line):

View File

@ -1665,18 +1665,24 @@ gpg_decrypt(CamelCipherContext *context, CamelMimePart *ipart, CamelMimePart *op
struct _GpgCtx *gpg;
CamelCipherValidity *valid = NULL;
CamelStream *ostream, *istream;
CamelDataWrapper *content;
CamelMimePart *encrypted;
CamelContentType *ct;
const char *protocol;
CamelMultipart *mp;
mp = (CamelMultipart *) camel_medium_get_content_object ((CamelMedium *) ipart);
if (!(encrypted = camel_multipart_get_part (mp, CAMEL_MULTIPART_ENCRYPTED_CONTENT))) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to decrypt MIME part: protocol error"));
return NULL;
}
content = camel_medium_get_content_object ((CamelMedium *) encrypted);
istream = camel_stream_mem_new();
camel_data_wrapper_write_to_stream(camel_medium_get_content_object((CamelMedium *)ipart), istream);
camel_data_wrapper_decode_to_stream (content, istream);
camel_stream_reset(istream);
/* TODO: de-canonicalise end of lines? */
/*stream = camel_stream_mem_new ();
filtered_stream = (CamelStream *) camel_stream_filter_new_with_stream (stream);
crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered_stream), crlf_filter);
camel_object_unref (crlf_filter);*/
ostream = camel_stream_mem_new();
camel_stream_mem_set_secure((CamelStreamMem *)ostream);