aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-04-18 05:20:19 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-04-18 05:20:19 +0800
commitfee3cf83f6833e34755c7c8492ef1a4088d91ae5 (patch)
tree0b93e6bd587b016a070417515e6d796360585048 /mail/mail-format.c
parentd89c3d0a9c4ea8fc31cc7f980df48669511ccca3 (diff)
downloadgsoc2013-evolution-fee3cf83f6833e34755c7c8492ef1a4088d91ae5.tar.gz
gsoc2013-evolution-fee3cf83f6833e34755c7c8492ef1a4088d91ae5.tar.zst
gsoc2013-evolution-fee3cf83f6833e34755c7c8492ef1a4088d91ae5.zip
Handle broken multipart/signed parts such as where the signature part is
2002-04-17 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (handle_multipart_signed): Handle broken multipart/signed parts such as where the signature part is not the last part (as it should be). Fixes bug #23583. * folder-browser.c (message_list_drag_data_get): Free the temp GByteArrays. (setup_popup_icons): Connect to the destroy signal on the pixmap objects using gtk_object_unref as the callback - this way when the popup menu gets destroyed, the pixmaps clean themselves up. (on_right_click): Same idea for the label_menu. svn path=/trunk/; revision=16494
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 79bc90c9fb..eb5723da17 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1763,22 +1763,34 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
- /* Display all the subparts (there should be only 1)
- * except the signature (last part).
+ /* Display all the subparts (there should be only 1) up to, but not including,
+ * the signature. (this should be the last part but we all know that most
+ * mailers are broken, so attempt to handle broken multipart/signed messages).
+ * See bug #23583 for details.
*/
mp = CAMEL_MULTIPART (wrapper);
nparts = camel_multipart_get_number (mp);
- for (i = 0; i < nparts - 1; i++) {
- if (i != 0 && output)
- write_hr (html, stream);
+ for (i = 0; i < nparts; i++) {
+ CamelContentType *content_type;
subpart = camel_multipart_get_part (mp, i);
+ content_type = camel_mime_part_get_content_type (subpart);
+
+ if (header_content_type_is (content_type, "application", "pgp-signature"))
+ break;
+
+ if (i != 0 && output)
+ write_hr (html, stream);
output = format_mime_part (subpart, md, html, stream);
}
- subpart = camel_multipart_get_part (mp, i);
+ if (i >= nparts) {
+ /* no signature part? wtf? */
+ return TRUE;
+ }
+
mail_part_set_default_displayed_inline (subpart, md, FALSE);
if (!mail_part_is_displayed_inline (subpart, md) && !md->printing) {
@@ -1852,6 +1864,17 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
camel_cipher_validity_free (valid);
}
+ /* continuation of handling broken multipart/signed
+ * parts... write out any extra parts that were added after
+ * the signature part. */
+ for (i++; i < nparts; i++) {
+ subpart = camel_multipart_get_part (mp, i);
+
+ write_hr (html, stream);
+
+ output = format_mime_part (subpart, md, html, stream);
+ }
+
return TRUE;
}