diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-07 08:47:22 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-07 08:47:22 +0100 |
commit | 18159927e8f37a1858f9757803b20744fcfff505 (patch) | |
tree | 20bcaf53435839502e6cb2239132913a101fec69 /mailnews/mime/src | |
parent | 642032029f65e9dc0d38fbb6d35ef656c73a292c (diff) | |
parent | 5ba7f92d5a26581c91649006d9c97e4f244663e9 (diff) | |
download | UXP-18159927e8f37a1858f9757803b20744fcfff505.tar UXP-18159927e8f37a1858f9757803b20744fcfff505.tar.gz UXP-18159927e8f37a1858f9757803b20744fcfff505.tar.lz UXP-18159927e8f37a1858f9757803b20744fcfff505.tar.xz UXP-18159927e8f37a1858f9757803b20744fcfff505.zip |
Merge branch 'master' into release
Diffstat (limited to 'mailnews/mime/src')
-rw-r--r-- | mailnews/mime/src/mimei.cpp | 38 | ||||
-rw-r--r-- | mailnews/mime/src/mimemalt.cpp | 4 | ||||
-rw-r--r-- | mailnews/mime/src/mimesun.cpp | 3 |
3 files changed, 25 insertions, 20 deletions
diff --git a/mailnews/mime/src/mimei.cpp b/mailnews/mime/src/mimei.cpp index 015830a80..568b6bca5 100644 --- a/mailnews/mime/src/mimei.cpp +++ b/mailnews/mime/src/mimei.cpp @@ -725,21 +725,20 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs, else if (!PL_strcasecmp(content_type, APPLICATION_XPKCS7_MIME) || !PL_strcasecmp(content_type, APPLICATION_PKCS7_MIME)) { - if (Preferences::GetBool("mailnews.p7m_subparts_external", false) && - opts->is_child) { - // We do not allow encrypted parts except as top level. - // Allowing them would leak the plain text in case the part is - // cleverly hidden and the decrypted content gets included in - // replies and forwards. - clazz = (MimeObjectClass *)&mimeSuppressedCryptoClass; - return clazz; - } - - char *ct = (hdrs ? MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE, - false, false) - : nullptr); - char *st = (ct ? MimeHeaders_get_parameter(ct, "smime-type", NULL, NULL) - : nullptr); + if (Preferences::GetBool("mailnews.p7m_subparts_external", true) && + opts->is_child) { + // We do not allow encrypted parts except as top level. + // Allowing them would leak the plain text in case the part is + // cleverly hidden and the decrypted content gets included in + // replies and forwards. + clazz = (MimeObjectClass *)&mimeSuppressedCryptoClass; + } else { + char *ct = + hdrs ? MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE, false, false) + : nullptr; + char *st = + ct ? MimeHeaders_get_parameter(ct, "smime-type", nullptr, nullptr) + : nullptr; /* by default, assume that it is an encrypted message */ clazz = (MimeObjectClass *)&mimeEncryptedCMSClass; @@ -747,9 +746,8 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs, /* if the smime-type parameter says that it's a certs-only or compressed file, then show it as an attachment, however (MimeEncryptedCMS doesn't handle these correctly) */ - if (st && - (!PL_strcasecmp(st, "certs-only") || - !PL_strcasecmp(st, "compressed-data"))) + if (st && (!PL_strcasecmp(st, "certs-only") || + !PL_strcasecmp(st, "compressed-data"))) clazz = (MimeObjectClass *)&mimeExternalObjectClass; else { /* look at the file extension... less reliable, but still covered @@ -763,14 +761,14 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs, prefBranch->GetBoolPref("mailnews.p7m_external", &p7mExternal); if (suf && ((!PL_strcasecmp(suf, ".p7m") && p7mExternal) || - !PL_strcasecmp(suf, ".p7c") || - !PL_strcasecmp(suf, ".p7z"))) + !PL_strcasecmp(suf, ".p7c") || !PL_strcasecmp(suf, ".p7z"))) clazz = (MimeObjectClass *)&mimeExternalObjectClass; } PR_Free(name); } PR_Free(st); PR_Free(ct); + } } #endif /* A few types which occur in the real world and which we would otherwise diff --git a/mailnews/mime/src/mimemalt.cpp b/mailnews/mime/src/mimemalt.cpp index 3354b1f9b..9ad750cd7 100644 --- a/mailnews/mime/src/mimemalt.cpp +++ b/mailnews/mime/src/mimemalt.cpp @@ -282,6 +282,10 @@ MimeMultipartAlternative_parse_eof (MimeObject *obj, bool abort_p) static int MimeMultipartAlternative_create_child(MimeObject *obj) { + if (obj->options) { + obj->options->is_child = true; + } + MimeMultipart *mult = (MimeMultipart *) obj; MimeMultipartAlternative *malt = (MimeMultipartAlternative *) obj; diff --git a/mailnews/mime/src/mimesun.cpp b/mailnews/mime/src/mimesun.cpp index 84f06a885..aa7809b24 100644 --- a/mailnews/mime/src/mimesun.cpp +++ b/mailnews/mime/src/mimesun.cpp @@ -90,6 +90,9 @@ MimeSunAttachment_check_boundary(MimeObject *obj, const char *line, static int MimeSunAttachment_create_child(MimeObject *obj) { + if (obj->options) { + obj->options->is_child = true; + } MimeMultipart *mult = (MimeMultipart *) obj; int status = 0; |