Fix for bug 141730 (second try, with #ifdef this time). When forwarding inline or replying to an encrypted message, we need to decrypt the message body. R=kaie, SR=bienvenu,sspitzer

This commit is contained in:
ducarroz%netscape.com 2002-08-07 06:27:43 +00:00
Родитель 2d31535efd
Коммит 155328949b
2 изменённых файлов: 27 добавлений и 16 удалений

Просмотреть файл

@ -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 )

Просмотреть файл

@ -52,6 +52,7 @@
#include "nsEscape.h"
#include "nsString.h"
#include "mimetext.h"
#include "mimecryp.h"
#define MIME_SUPERCLASS mimeContainerClass
MimeDefClass(MimeMessage, MimeMessageClass, mimeMessageClass,
@ -294,9 +295,10 @@ 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 */
#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,
@ -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.
@ -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 );
@ -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 (