Skip to content

Commit

Permalink
Fix for bug 141730 (second try, with #ifdef this time). When forwardi…
Browse files Browse the repository at this point in the history
…ng inline or replying to an encrypted message, we need to decrypt the message body. R=kaie, SR=bienvenu,sspitzer
  • Loading branch information
ducarroz%netscape.com committed Aug 7, 2002
1 parent 2d31535 commit 1553289
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
4 changes: 1 addition & 3 deletions mailnews/mime/src/mimedrft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2092,14 +2092,12 @@ mime_bridge_create_draft_stream(
if (! (mdd->options->prefs && NS_SUCCEEDED(rv)))
goto FAIL;

#ifdef FO_MAIL_MESSAGE_TO
/* If we're attaching a message (for forwarding) then we must eradicate all
traces of xlateion from it, since forwarding someone else a message
that wasn't xlated for them doesn't work. We have to dexlate it
before sending it.
*/
// RICHIE mdd->options->dexlate_p = PR_TRUE;
#endif /* FO_MAIL_MESSAGE_TO */
mdd->options->decrypt_p = PR_TRUE;

obj = mime_new ( (MimeObjectClass *) &mimeMessageClass, (MimeHeaders *) NULL, MESSAGE_RFC822 );
if ( !obj )
Expand Down
39 changes: 26 additions & 13 deletions mailnews/mime/src/mimemsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "nsEscape.h"
#include "nsString.h"
#include "mimetext.h"
#include "mimecryp.h"

#define MIME_SUPERCLASS mimeContainerClass
MimeDefClass(MimeMessage, MimeMessageClass, mimeMessageClass,
Expand Down Expand Up @@ -294,10 +295,11 @@ MimeMessage_close_headers (MimeObject *obj)
(obj->options->decompose_file_p || obj->options->caller_need_root_headers) &&
obj->options->decompose_headers_info_fn)
{
#ifdef MOZ_SECURITY
HG09091
#endif /* MOZ_SECURITY */
if (!obj->options->caller_need_root_headers || (obj == obj->options->state->root))
#ifdef ENABLE_SMIME
if (obj->options->decrypt_p && !mime_crypto_object_p (msg->hdrs, PR_FALSE))
obj->options->decrypt_p = PR_FALSE;
#endif /* ENABLE_SMIME */
if (!obj->options->caller_need_root_headers || (obj == obj->options->state->root))
status = obj->options->decompose_headers_info_fn (
obj->options->stream_closure,
msg->hdrs );
Expand Down Expand Up @@ -385,9 +387,24 @@ HG09091
PR_FREEIF(mv); /* done with this now. */
}

#ifdef MOZ_SECURITY
HG67023
#endif /* MOZ_SECURITY */
#ifdef ENABLE_SMIME
/* If this message has a body which is encrypted and we're going to
decrypt it (whithout converting it to HTML, since decrypt_p and
write_html_p are never true at the same time)
*/
if (obj->output_p &&
obj->options &&
obj->options->decrypt_p &&
!mime_crypto_object_p (msg->hdrs, PR_FALSE))
{
/* The body of this message is not an encrypted object, so we need
to turn off the decrypt_p flag (to prevent us from s#$%ing the
body of the internal object up into one.) In this case,
our output will end up being identical to our input.
*/
obj->options->decrypt_p = PR_FALSE;
}
#endif /* ENABLE_SMIME */

/* Emit the HTML for this message's headers. Do this before
creating the object representing the body.
Expand Down Expand Up @@ -555,9 +572,7 @@ MimeMessage_parse_eof (MimeObject *obj, PRBool abort_p)
obj->options->decompose_file_p &&
obj->options->done_parsing_outer_headers &&
! obj->options->is_multipart_msg &&
#ifdef MOZ_SECURITY
HG00234
#endif /* MOZ_SECURITY */
! mime_typep(obj, (MimeObjectClass*) &mimeEncryptedClass) &&
obj->options->decompose_file_close_fn ) {
status = obj->options->decompose_file_close_fn (
obj->options->stream_closure );
Expand Down Expand Up @@ -593,9 +608,7 @@ MimeMessage_add_child (MimeObject *parent, MimeObject *child)
if ( parent->options &&
parent->options->decompose_file_p &&
! parent->options->is_multipart_msg &&
#ifdef MOZ_SECURITY
HG00234
#endif /* MOZ_SECURITY */
! mime_typep(child, (MimeObjectClass*) &mimeEncryptedClass) &&
parent->options->decompose_file_init_fn ) {
int status = 0;
status = parent->options->decompose_file_init_fn (
Expand Down

0 comments on commit 1553289

Please sign in to comment.