You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

467432-write_bcc.patch 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. From: Antonio Radici <antonio@debian.org>
  2. Date: Thu, 27 Feb 2014 16:22:51 +0100
  3. Subject: 467432-write_bcc
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset="utf-8"
  6. Content-Transfer-Encoding: 8bit
  7. The purpose of this patch is to alter the behavior of the write_bcc option
  8. because exim4, the default SMTP in Debian, does not strip the Bcc headers; by
  9. default write_bcc is set so this could cause a privacy leak.
  10. The behavior that this patch introduces is: never write the Bcc header when the
  11. message is sent, otherwise, if the message is sent to Fcc, then this optin
  12. will be evaluated and the Bcc header will be written based on that.
  13. Background discussion on this is in the following bugs:
  14. http://bugs.debian.org/304718
  15. http://bugs.debian.org/467432
  16. This patch is a slightly modified version of the patch provided by
  17. Stefan Völkel <stefan@bc-bd.org> in the second bug.
  18. Gbp-Pq: Topic debian-specific
  19. ---
  20. headers.c | 2 +-
  21. init.h | 11 +++--------
  22. protos.h | 2 +-
  23. send.c | 4 ++--
  24. sendlib.c | 6 +++---
  25. 5 files changed, 10 insertions(+), 15 deletions(-)
  26. diff --git a/headers.c b/headers.c
  27. index 578b33d..f701c8e 100644
  28. --- a/headers.c
  29. +++ b/headers.c
  30. @@ -52,7 +52,7 @@ void mutt_edit_headers (const char *editor,
  31. }
  32. mutt_env_to_local (msg->env);
  33. - mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0);
  34. + mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0, 1);
  35. fputc ('\n', ofp); /* tie off the header. */
  36. /* now copy the body of the message. */
  37. diff --git a/init.h b/init.h
  38. index 875cad8..42b79d6 100644
  39. --- a/init.h
  40. +++ b/init.h
  41. @@ -3440,14 +3440,9 @@ struct option_t MuttVars[] = {
  42. { "write_bcc", DT_BOOL, R_NONE, OPTWRITEBCC, 1},
  43. /*
  44. ** .pp
  45. - ** Controls whether mutt writes out the ``Bcc:'' header when preparing
  46. - ** messages to be sent. Exim users may wish to unset this. If mutt
  47. - ** is set to deliver directly via SMTP (see $$smtp_url), this
  48. - ** option does nothing: mutt will never write out the ``Bcc:'' header
  49. - ** in this case.
  50. - ** .pp
  51. - ** \fBNote:\fP On Debian systems, exim4 and postfix strip BCC headers by
  52. - ** default. The above warning applies to exim3 users, see /etc/Muttrc.
  53. + ** Controls whether mutt writes out the Bcc header when saving
  54. + ** messages to FCC. Bcc headers will never be written to a message
  55. + ** when sending it. Note: this behavior is Debian specific.
  56. */
  57. { "write_inc", DT_NUM, R_NONE, UL &WriteInc, 10 },
  58. /*
  59. diff --git a/protos.h b/protos.h
  60. index 8542f91..38c8c01 100644
  61. --- a/protos.h
  62. +++ b/protos.h
  63. @@ -366,7 +366,7 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int, char
  64. int mutt_write_mime_body (BODY *, FILE *);
  65. int mutt_write_mime_header (BODY *, FILE *);
  66. int mutt_write_one_header (FILE *fp, const char *tag, const char *value, const char *pfx, int wraplen, int flags);
  67. -int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int);
  68. +int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int, int, int);
  69. void mutt_write_references (LIST *, FILE *, int);
  70. int mutt_yesorno (const char *, int);
  71. void mutt_set_header_color(CONTEXT *, HEADER *);
  72. diff --git a/send.c b/send.c
  73. index fce003c..18b9390 100644
  74. --- a/send.c
  75. +++ b/send.c
  76. @@ -994,10 +994,10 @@ static int send_message (HEADER *msg)
  77. unset_option (OPTWRITEBCC);
  78. #endif
  79. #ifdef MIXMASTER
  80. - mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, msg->chain ? 1 : 0);
  81. + mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, msg->chain ? 1 : 0, 0);
  82. #endif
  83. #ifndef MIXMASTER
  84. - mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, 0);
  85. + mutt_write_rfc822_header (tempfp, msg->env, msg->content, 0, 0, 0);
  86. #endif
  87. #ifdef USE_SMTP
  88. if (old_write_bcc)
  89. diff --git a/sendlib.c b/sendlib.c
  90. index cede853..0f05298 100644
  91. --- a/sendlib.c
  92. +++ b/sendlib.c
  93. @@ -1929,7 +1929,7 @@ out:
  94. int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,
  95. - int mode, int privacy)
  96. + int mode, int privacy, int should_write_bcc)
  97. {
  98. char buffer[LONG_STRING];
  99. char *p, *q;
  100. @@ -1972,7 +1972,7 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,
  101. else if (mode > 0)
  102. fputs ("Cc: \n", fp);
  103. - if (env->bcc)
  104. + if (env->bcc && should_write_bcc)
  105. {
  106. if(mode != 0 || option(OPTWRITEBCC))
  107. {
  108. @@ -2727,7 +2727,7 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post,
  109. /* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header()
  110. * post == 0 => Normal mode. Set mode = 0 in mutt_write_rfc822_header()
  111. * */
  112. - mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0, 0);
  113. + mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0, 0, 1);
  114. /* (postponment) if this was a reply of some sort, <msgid> contians the
  115. * Message-ID: of message replied to. Save it using a special X-Mutt-