Re: [evolution-patches] fix for bug #69241



committed after fixing the issues pointed out by your comments.

Jeff

On Tue, 2004-11-09 at 06:37 +0800, Not Zed wrote:
> 
> None of the checks are required, these are performed in the mail code.
> If the wrong data gets passed by other clients thats their fault.
> 
> You should use CAMEL_MULTIPART_ENCRYPTED_CONTENT rather than 1 as the
> multipart number.
> 
> And you should check that the content part actually exists (and fail
> if it doesn't).  It'd probably also be better if it didn't re-use the
> ipart variable.
> 
> On Mon, 2004-11-08 at 14:25 -0500, Jeffrey Stedfast wrote: 
> > er, this patch didn't work. I've attached a patch that works this
> > time :)
> > 
> > Jeff
> > 
> > On Mon, 2004-11-08 at 13:32 -0500, Jeffrey Stedfast wrote:
> > > Needed to decode the content stream to gpg, not pass it the encoded
> > > stream.
> > > 
> > > Jeff
> > 
> > text/plain attachment (69241.patch)
> > Index: ChangeLog
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
> > retrieving revision 1.2296
> > diff -u -r1.2296 ChangeLog
> > --- ChangeLog	4 Nov 2004 20:52:49 -0000	1.2296
> > +++ ChangeLog	8 Nov 2004 19:24:08 -0000
> > @@ -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-04  Jeffrey Stedfast  <fejj novell com>
> >  
> >  	* providers/imap4/camel-imap4-engine.c: Added much in-line
> > Index: camel-gpg-context.c
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/camel/camel-gpg-context.c,v
> > retrieving revision 1.63
> > diff -u -r1.63 camel-gpg-context.c
> > --- camel-gpg-context.c	20 Sep 2004 05:59:53 -0000	1.63
> > +++ camel-gpg-context.c	8 Nov 2004 19:24:08 -0000
> > @@ -1665,18 +1665,28 @@
> >  	struct _GpgCtx *gpg;
> >  	CamelCipherValidity *valid = NULL;
> >  	CamelStream *ostream, *istream;
> > -
> > +	CamelContentType *ct;
> > +	const char *protocol;
> > +	CamelMultipart *mp;
> > +	
> > +	mp = (CamelMultipart *) camel_medium_get_content_object ((CamelMedium *) ipart);
> > +	ct = ((CamelDataWrapper *) mp)->mime_type;
> > +	protocol = camel_content_type_param (ct, "protocol");
> > +	if (!camel_content_type_is (ct, "multipart", "encrypted")
> > +	    || !CAMEL_IS_MULTIPART_ENCRYPTED (mp)
> > +	    || protocol == NULL
> > +	    || g_ascii_strcasecmp (protocol, context->encrypt_protocol) != 0) {
> > +		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
> > +				      _("Cannot decrypt message: Incorrect message format"));
> > +		return NULL;
> > +	}
> > +	
> > +	ipart = camel_multipart_get_part (mp, 1);
> > +	
> >  	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(camel_medium_get_content_object((CamelMedium *)ipart), 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);
> >  
-- 
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com  - www.novell.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature



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