Write out the protected headers when writing the mime header part.
Hide protected subjects with $crypt_protected_headers_subject, for
outgoing, postponed, and fcc'ed messages.
Don't hide in postponed and fcc'ed if $crypt_protected_headers_read
isn't set.
Add a few missing cases where mime_headers needed to be cleaned up on
error.
Remove the protected headers for $fcc_clear.
}
}
+int mutt_should_hide_protected_subject (HEADER *h)
+{
+ if (option (OPTCRYPTPROTHDRSWRITE) &&
+ (h->security & ENCRYPT) &&
+ !(h->security & INLINE) &&
+ ProtHdrSubject && *ProtHdrSubject)
+ return 1;
+
+ return 0;
+}
+
int mutt_protected_headers_handler (BODY *a, STATE *s)
{
if (option (OPTCRYPTPROTHDRSREAD) && a->mime_headers)
}
mutt_env_to_local (msg->env);
- mutt_write_rfc822_header (ofp, msg->env, NULL, MUTT_WRITE_HEADER_EDITHDRS, 0);
+ mutt_write_rfc822_header (ofp, msg->env, NULL, MUTT_WRITE_HEADER_EDITHDRS, 0, 0);
fputc ('\n', ofp); /* tie off the header. */
/* now copy the body of the message. */
}
mutt_write_rfc822_header (fout, msg->env, msg->content,
- MUTT_WRITE_HEADER_POSTPONE, 0);
+ MUTT_WRITE_HEADER_POSTPONE, 0,
+ option (OPTCRYPTPROTHDRSREAD) &&
+ mutt_should_hide_protected_subject (msg));
if (option (OPTRESUMEEDITEDDRAFTFILES))
fprintf (fout, "X-Mutt-Resume-Draft: 1\n");
fputc ('\n', fout);
int mutt_is_application_smime (BODY *);
+int mutt_should_hide_protected_subject (HEADER *);
+
int mutt_protected_headers_handler (BODY *, STATE *);
int mutt_signed_handler (BODY *, STATE *);
int mutt_write_mime_body (BODY *, FILE *);
int mutt_write_mime_header (BODY *, FILE *);
int mutt_write_one_header (FILE *fp, const char *tag, const char *value, const char *pfx, int wraplen, int flags);
-int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, mutt_write_header_mode, int);
+int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, mutt_write_header_mode, int, int);
void mutt_write_references (LIST *, FILE *, int);
int mutt_yesorno (const char *, int);
void mutt_set_header_color(CONTEXT *, HEADER *);
#endif
#ifdef MIXMASTER
mutt_write_rfc822_header (tempfp, msg->env, msg->content,
- MUTT_WRITE_HEADER_NORMAL, msg->chain ? 1 : 0);
+ MUTT_WRITE_HEADER_NORMAL, msg->chain ? 1 : 0,
+ mutt_should_hide_protected_subject (msg));
#endif
#ifndef MIXMASTER
mutt_write_rfc822_header (tempfp, msg->env, msg->content,
- MUTT_WRITE_HEADER_NORMAL, 0);
+ MUTT_WRITE_HEADER_NORMAL, 0,
+ mutt_should_hide_protected_subject (msg));
#endif
#ifdef USE_SMTP
if (old_write_bcc)
return rc;
if (WithCrypto && (msg->security & (ENCRYPT | SIGN)) && option (OPTFCCCLEAR))
+ {
msg->content = clear_content;
+ msg->security &= ~(ENCRYPT | SIGN);
+ mutt_free_envelope (&msg->content->mime_headers);
+ }
/* check to see if the user wants copies of all attachments */
if (query_quadoption (OPT_FCCATTACH, _("Save attachments in Fcc?")) != MUTT_YES &&
mutt_free_body (&msg->content);
msg->content = clear_content;
}
+ mutt_free_envelope (&msg->content->mime_headers); /* protected headers */
msg->content = mutt_remove_multipart (msg->content);
decode_descriptions (msg->content);
mutt_unprepare_envelope (msg->env);
msg->content = mutt_remove_multipart (msg->content);
}
+ mutt_free_envelope (&msg->content->mime_headers); /* protected headers */
msg->content = mutt_remove_multipart (msg->content);
decode_descriptions (msg->content);
mutt_unprepare_envelope (msg->env);
mutt_message (i == 0 ? _("Mail sent.") : _("Sending in background."));
- if (WithCrypto && (msg->security & ENCRYPT))
+ if (WithCrypto)
FREE (&pgpkeylist);
-
+
if (WithCrypto && free_clear_content)
mutt_free_body (&clear_content);
if (a->encoding != ENC7BIT)
fprintf(f, "Content-Transfer-Encoding: %s\n", ENCODING (a->encoding));
+ if (option (OPTCRYPTPROTHDRSWRITE) && a->mime_headers)
+ mutt_write_rfc822_header (f, a->mime_headers, NULL, MUTT_WRITE_HEADER_MIME, 0, 0);
+
/* Do NOT add the terminator here!!! */
return (ferror (f) ? -1 : 0);
}
* Output generated is suitable for being sent through
* anonymous remailer chains.
*
+ * hide_protected_subject: replaces the Subject header with
+ * $crypt_protected_headers_subject in NORMAL or POSTPONE mode.
+ *
*/
-
-
-
int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,
- mutt_write_header_mode mode, int privacy)
+ mutt_write_header_mode mode, int privacy,
+ int hide_protected_subject)
{
char buffer[LONG_STRING];
char *p, *q;
fputs ("Bcc: \n", fp);
if (env->subject)
- mutt_write_one_header (fp, "Subject", env->subject, NULL, 0, 0);
+ {
+ if (hide_protected_subject &&
+ (mode == MUTT_WRITE_HEADER_NORMAL ||
+ mode == MUTT_WRITE_HEADER_POSTPONE))
+ mutt_write_one_header (fp, "Subject", ProtHdrSubject, NULL, 0, 0);
+ else
+ mutt_write_one_header (fp, "Subject", env->subject, NULL, 0, 0);
+ }
else if (mode == MUTT_WRITE_HEADER_EDITHDRS)
fputs ("Subject: \n", fp);
* */
mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content,
post ? MUTT_WRITE_HEADER_POSTPONE : MUTT_WRITE_HEADER_NORMAL,
- 0);
+ 0,
+ option (OPTCRYPTPROTHDRSREAD) &&
+ mutt_should_hide_protected_subject (hdr));
/* (postponment) if this was a reply of some sort, <msgid> contains the
* Message-ID: of message replied to. Save it using a special X-Mutt-