aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-06-15 23:19:23 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-06-15 23:19:23 +0800
commitfb0093754d08b2e3d98b28b4ef56e277a82f100e (patch)
tree93cf0531714773a4251b1f937764ab52518cefa8 /camel
parent1d1746c2d8408d5af2fe52744654edf7a17c7fdf (diff)
downloadgsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.tar
gsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.tar.gz
gsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.tar.bz2
gsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.tar.lz
gsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.tar.xz
gsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.tar.zst
gsoc2013-evolution-fb0093754d08b2e3d98b28b4ef56e277a82f100e.zip
Use camel_multipart_signed_get_content_stream() rather than getting the
2004-06-15 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_verify): Use camel_multipart_signed_get_content_stream() rather than getting the first part and canonicalising it ourselves. Fixes bug #60159. svn path=/trunk/; revision=26350
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/camel-gpg-context.c23
2 files changed, 16 insertions, 11 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 3abe96ac18..1001ff425b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,9 @@
2004-06-15 Jeffrey Stedfast <fejj@ximian.com>
+ * camel-gpg-context.c (gpg_verify): Use
+ camel_multipart_signed_get_content_stream() rather than getting
+ the first part and canonicalising it ourselves. Fixes bug #60159.
+
* providers/imap4/camel-imap4-stream.c (camel_imap4_stream_init):
Init have_unget to FALSE. Don't set unget to NULL, it's no longer
a pointer.
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index adcd40cb17..7f7a493bce 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -1385,7 +1385,7 @@ gpg_verify (CamelCipherContext *context, CamelMimePart *ipart, CamelException *e
struct _GpgCtx *gpg = NULL;
char *sigfile = NULL;
CamelContentType *ct;
- CamelMimePart *sigpart, *datapart;
+ CamelMimePart *sigpart;
CamelStream *istream = NULL;
CamelMultipart *mps;
@@ -1401,15 +1401,19 @@ gpg_verify (CamelCipherContext *context, CamelMimePart *ipart, CamelException *e
return NULL;
}
- datapart = camel_multipart_get_part(mps, CAMEL_MULTIPART_SIGNED_CONTENT);
- sigpart = camel_multipart_get_part(mps, CAMEL_MULTIPART_SIGNED_SIGNATURE);
-
- if (sigpart == NULL || datapart == NULL) {
+ if (!(istream = camel_multipart_signed_get_content_stream ((CamelMultipartSigned *) mps, NULL))) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot verify message signature: Incorrect message format"));
- goto exception;
+ return NULL;
}
-
+
+ if (!(sigpart = camel_multipart_get_part (mps, CAMEL_MULTIPART_SIGNED_SIGNATURE))) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot verify message signature: Incorrect message format"));
+ camel_object_unref (istream);
+ return NULL;
+ }
+
sigfile = swrite (sigpart);
if (sigfile == NULL) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -1417,11 +1421,8 @@ gpg_verify (CamelCipherContext *context, CamelMimePart *ipart, CamelException *e
g_strerror (errno));
goto exception;
}
-
- istream = camel_stream_mem_new();
- camel_cipher_canonical_to_stream(datapart, CAMEL_MIME_FILTER_CANON_CRLF, istream);
- camel_stream_reset(istream);
+ camel_stream_reset(istream);
gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_VERIFY);
gpg_ctx_set_hash (gpg, camel_cipher_id_to_hash(context, camel_content_type_param(ct, "micalg")));