diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-11 01:56:34 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-11 01:56:34 -0500 |
commit | 73e14fb7049306439a5637ff261f1370a94518e5 (patch) | |
tree | f9ef6c4782b0849bae1927f2c1ab9bbd8d97aa4d /mailnews/mime/src/mimemsig.cpp | |
parent | dc77b707f20280cd057368ca11fafc2c0bfc9414 (diff) | |
download | UXP-73e14fb7049306439a5637ff261f1370a94518e5.tar UXP-73e14fb7049306439a5637ff261f1370a94518e5.tar.gz UXP-73e14fb7049306439a5637ff261f1370a94518e5.tar.lz UXP-73e14fb7049306439a5637ff261f1370a94518e5.tar.xz UXP-73e14fb7049306439a5637ff261f1370a94518e5.zip |
Bug 1240290
Tag #1273
Diffstat (limited to 'mailnews/mime/src/mimemsig.cpp')
-rw-r--r-- | mailnews/mime/src/mimemsig.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/mailnews/mime/src/mimemsig.cpp b/mailnews/mime/src/mimemsig.cpp index d74cfb09a..bb34607cb 100644 --- a/mailnews/mime/src/mimemsig.cpp +++ b/mailnews/mime/src/mimemsig.cpp @@ -14,6 +14,7 @@ #include "msgCore.h" #include "nsMimeStringResources.h" #include "mimemoz2.h" +#include "mimeeobj.h" #include "nsIMimeConverter.h" // for MimeConverterOutputCallback #include "mozilla/Attributes.h" @@ -32,6 +33,8 @@ static void MimeMultipartSigned_finalize (MimeObject *); static int MimeMultipartSigned_emit_child (MimeObject *obj); +extern "C" MimeSuppressedCryptoClass mimeSuppressedCryptoClass; + static int MimeMultipartSignedClassInitialize(MimeMultipartSignedClass *clazz) { @@ -582,6 +585,11 @@ MimeMultipartSigned_emit_child (MimeObject *obj) int status = 0; MimeObject *body; + if (!sig->crypto_closure) { + // We might have decided to skip processing this part. + return 0; + } + NS_ASSERTION(sig->crypto_closure, "no crypto closure"); /* Emit some HTML saying whether the signature was cool. @@ -594,15 +602,11 @@ MimeMultipartSigned_emit_child (MimeObject *obj) obj->options->headers != MimeHeadersCitation && sig->crypto_closure) { + // Calling crypto_generate_html may trigger wanted side effects, + // but we're no longer using its results. char *html = (((MimeMultipartSignedClass *) obj->clazz) ->crypto_generate_html (sig->crypto_closure)); -#if 0 // XXX For the moment, no HTML output. Fix this XXX // - if (!html) return -1; /* MIME_OUT_OF_MEMORY? */ - - status = MimeObject_write(obj, html, strlen(html), false); - PR_Free(html); - if (status < 0) return status; -#endif + PR_FREEIF(html); /* Now that we have written out the crypto stamp, the outermost header block is well and truly closed. If this is in fact the outermost @@ -719,6 +723,11 @@ MimeMultipartSigned_emit_child (MimeObject *obj) if (!body) return -1; + if (mime_typep(body, (MimeObjectClass *)&mimeSuppressedCryptoClass)) { + ((MimeMultipartSignedClass *)obj->clazz) + ->crypto_notify_suppressed_child(sig->crypto_closure); + } + #ifdef MIME_DRAFTS if (body->options->decompose_file_p) { body->options->signed_p = true; |