evolution-data-server r10096 - trunk/camel
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r10096 - trunk/camel
- Date: Wed, 25 Feb 2009 11:14:07 +0000 (UTC)
Author: mcrha
Date: Wed Feb 25 11:14:07 2009
New Revision: 10096
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=10096&view=rev
Log:
2009-02-25 Milan Crha <mcrha redhat com>
** Fix for bug #571046
* camel-gpg-context.c: (gpg_verify):
Always strip trailing white-spaces added during message transmission,
before verifying message signature.
Modified:
trunk/camel/ChangeLog
trunk/camel/camel-gpg-context.c
Modified: trunk/camel/camel-gpg-context.c
==============================================================================
--- trunk/camel/camel-gpg-context.c (original)
+++ trunk/camel/camel-gpg-context.c Wed Feb 25 11:14:07 2009
@@ -1437,9 +1437,11 @@
char *sigfile = NULL;
CamelContentType *ct;
CamelMimePart *sigpart;
- CamelStream *istream = NULL;
+ CamelStream *istream = NULL, *canon_stream;
CamelMultipart *mps;
-
+ CamelStreamFilter *filter;
+ CamelMimeFilter *canon;
+
mps = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)ipart);
ct = ((CamelDataWrapper *)mps)->mime_type;
@@ -1526,11 +1528,26 @@
}
camel_stream_reset(istream);
+ canon_stream = camel_stream_mem_new ();
+
+ /* strip trailing white-spaces */
+ filter = camel_stream_filter_new_with_stream (canon_stream);
+ canon = camel_mime_filter_canon_new (CAMEL_MIME_FILTER_CANON_CRLF | CAMEL_MIME_FILTER_CANON_STRIP);
+ camel_stream_filter_add (filter, canon);
+ camel_object_unref (canon);
+
+ camel_stream_write_to_stream (istream, (CamelStream *)filter);
+
+ camel_object_unref (filter);
+ camel_stream_reset (istream);
+
+ camel_stream_reset (canon_stream);
+
gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_VERIFY);
if (sigfile)
gpg_ctx_set_sigfile (gpg, sigfile);
- gpg_ctx_set_istream (gpg, istream);
+ gpg_ctx_set_istream (gpg, canon_stream);
if (gpg_ctx_op_start (gpg) == -1) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -1567,6 +1584,7 @@
g_free (sigfile);
}
camel_object_unref(istream);
+ camel_object_unref (canon_stream);
return validity;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]