From: Alexander Zangerl Date: Sun, 9 Jun 2019 15:40:38 +0000 (-0400) Subject: - Fixed bcc to work with sendmail/pipe [Bug 55700]. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/fe9ab00a6a507867c3ab42101c17630c1217c29f?ds=sidebyside;hp=8aeb28b95bce93b69967f612ee437b66b61a332b - Fixed bcc to work with sendmail/pipe [Bug 55700]. And better documented that dcc doesn't work with sendmail/pipe. --- diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 3db7924d..a5b0f223 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -33,6 +33,8 @@ DEPRECATED FEATURES BUG FIXES --------- +- Fixed bcc to work with sendmail/pipe, and better documented that dcc + doesn't work with it [Bug 55700]. - An -attendee switch has been added to mhical(1), for use when more than one (or zero) attendees match a user's mailbox. - Fixed inc(1) and %(me) function escape to not obey Local-Mailbox profile diff --git a/man/post.man b/man/post.man index e49d10bf..39e66f60 100644 --- a/man/post.man +++ b/man/post.man @@ -89,9 +89,12 @@ components that contain addresses. .PP If a \*(lqBcc:\*(rq field is encountered, its addresses will be used for delivery, and the \*(lqBcc:\*(rq field will be removed from the message -sent to sighted recipients. The blind recipients will receive an entirely -new message with a minimal set of headers. Included in the body of the -message will be a copy of the message sent to the sighted recipients. +sent to sighted recipients. The blind recipients will receive an entirely +new message with a minimal set of headers. The body of this new message +will contain a copy of the message sent to the sighted recipients, either +marked up with the indicator text "Blind-Carbon-Copy" or encapsulated +as a MIME digest. +.PP If .B \-filter .I filterfile @@ -104,6 +107,28 @@ switch is given, then .B post will use the MIME rules for encapsulation. .PP +If a \*(lqDcc:\*(rq field is encountered and the +.B sendmail/pipe +mail transport method is not in use, its addresses will be used for +delivery, and the \*(lqDcc:\*(rq field will be removed from the message. The +blind recipients will receive exactly the same message as the sighted +recipients. *WARNING* Recipients listed in the \*(lqDcc:\*(rq field receive no +explicit indication that they have received a \*(lqblind copy\*(rq. +This can cause blind recipients to +inadvertently reply to all of the sighted recipients of the +original message, revealing that they received a blind copy. +On the other hand, since a normal reply to a message sent +via a \*(lqBcc:\*(rq field +will generate a reply only to the sender of the original message, +it takes extra effort in most mailers to reply to the included +message, and so would usually only be done deliberately, rather +than by accident. +.PP +.B post +rejects any message that contains a \*(lqDcc:\*(rq field if the +.B sendmail/pipe +mail transport method is used. +.PP The .B \-alias .I aliasfile diff --git a/man/send.man b/man/send.man index 383f8c49..a57ff48b 100644 --- a/man/send.man +++ b/man/send.man @@ -230,14 +230,16 @@ will abort with a If a \*(lqBcc:\*(rq field is encountered, its addresses will be used for delivery, and the \*(lqBcc:\*(rq field will be removed from the message sent to sighted recipients. The blind recipients will receive an entirely -new message with a minimal set of headers. Included in the body of the -message will be a copy of the message sent to the sighted recipients. +new message with a minimal set of headers. The body of this new message +will contain a copy of the message sent to the sighted recipients, either +marked up with the indicator text "Blind-Carbon-Copy" or encapsulated +as a MIME digest. .PP If a \*(lqDcc:\*(rq field is encountered and the .B sendmail/pipe mail transport method is not in use, its addresses will be used for delivery, and the \*(lqDcc:\*(rq field will be removed from the message. The -blind recipients will receive the same message sent to the sighted +blind recipients will receive exactly the same message as the sighted recipients. *WARNING* Recipients listed in the \*(lqDcc:\*(rq field receive no explicit indication that they have received a \*(lqblind copy\*(rq. This can cause blind recipients to @@ -249,6 +251,12 @@ will generate a reply only to the sender of the original message, it takes extra effort in most mailers to reply to the included message, and so would usually only be done deliberately, rather than by accident. +.PP +If the +.B sendmail/pipe +mail transport method is used, then messages containing +a \*(lqDcc:\*(rq field are rejected. + .PP If .B \-filter diff --git a/test/fakesendmail b/test/fakesendmail index 37b6e309..81b97620 100755 --- a/test/fakesendmail +++ b/test/fakesendmail @@ -43,7 +43,5 @@ if [ $found_dasht -eq 0 ]; then done else # sendmail/pipe - - #### This will delete any lines in the message body that start with Bcc:! - sed -e '/^[Bb][Cc][Cc]:/d' | $deliver + $deliver fi diff --git a/test/post/test-mts b/test/post/test-mts index cd0e727d..0f0c2a08 100755 --- a/test/post/test-mts +++ b/test/post/test-mts @@ -40,6 +40,7 @@ QUIT EOF # check invalid -mts selection +start_test 'invalid -mts selection' run_test "send -draft -mts invalid" \ "post: unsupported mts selection \"invalid\" send: message not delivered to anyone" @@ -57,12 +58,15 @@ MHMTSCONF="$mts_fakesendmail" test_sendmail () { run_prog send -draft -mts "$1" + send_status=$? shift # fakesendmail drops the message and any cc's into this mbox. - mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox - inc -silent -file "$mbox" - rm -f "$mbox" + if [ $send_status -eq 0 ]; then + mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox + inc -silent -file "$mbox" + rm -f "$mbox" + fi n=1 for expected in "$@"; do @@ -83,6 +87,7 @@ test_sendmail () } # check -mts sendmail/smtp +start_test '-mts sendmail/smtp' cat > "${MH_TEST_DIR}/Mail/draft" < To: Somebody Else @@ -109,6 +114,7 @@ test_sendmail sendmail/smtp "${testname}.expected" # check -mts sendmail/pipe # Dots are not stuffed because sendmail/pipe causes sendmail to be # invoked with -i. +start_test '-mts sendmail/pipe' cat > "${MH_TEST_DIR}/Mail/draft" < To: Somebody Else @@ -132,7 +138,8 @@ EOF test_sendmail sendmail/pipe "${testname}.expected" -# check Bcc +# check Bcc with sendmail/pipe +start_test 'Bcc with sendmail/pipe' cat > "${MH_TEST_DIR}/Mail/draft" < To: Somebody Else @@ -159,6 +166,7 @@ cat > "${testname}.expected2" < Date: Subject: Test +BCC: bcc@example.com ------- Blind-Carbon-Copy @@ -178,6 +186,25 @@ EOF test_sendmail sendmail/pipe "${testname}.expected1" "${testname}.expected2" +# check Dcc with sendmail/pipe: it is unsupported +start_test 'Dcc with sendmail/pipe' +cat > "${MH_TEST_DIR}/Mail/draft" < "${testname}.expected1" <"${testname}.actual1" +check "${testname}.actual1" "${testname}.expected1" + rm -f ${MHMTSCONF} +finish_test exit ${failed:-0} diff --git a/uip/post.c b/uip/post.c index c36f43aa..cf2ccf83 100644 --- a/uip/post.c +++ b/uip/post.c @@ -868,6 +868,12 @@ putfmt (char *name, char *str, int *eai, FILE *out) badmsg = true; return; } + if (hdr->flags & HDCC && sm_mts == MTS_SENDMAIL_PIPE) + { + inform("Dcc header is not supported with sendmail/pipe"); + badmsg = true; + return; + } msgflags |= (hdr->set & ~(MVIS | MINV)); if (hdr->flags & HSUB) @@ -1262,8 +1268,7 @@ putadr (char *name, char *aka, struct mailname *mp, FILE *out, if (mp->m_mbox == NULL || ((flags & HTRY) && !insert (mp))) return 0; - if (sm_mts != MTS_SENDMAIL_PIPE && - ((flags & (HBCC | HDCC | HEFM)) || mp->m_ingrp)) + if ((flags & (HBCC | HDCC | HEFM)) || mp->m_ingrp) return 1; if (!nameoutput) { @@ -1495,7 +1500,33 @@ make_bcc_file (int dashstuff) fprintf (out, "Message-ID: %s\n", message_id (tclock, 0)); if (subject) fprintf (out, "Subject: %s", subject); - fprintf (out, "BCC:\n"); + + /* for sendmail/pipe, insert all bcc recipients here so that the email can be routed based on the bcc: header */ + if (sm_mts == MTS_SENDMAIL_PIPE) + { + char *allbcc = NULL; + struct mailname *lp; + + for (lp = localaddrs.m_next; lp; lp = lp->m_next) + if (lp->m_bcc) + allbcc = allbcc? add(concat(", ", lp->m_mbox, NULL), allbcc) + : mh_xstrdup(lp->m_mbox); + for (lp = netaddrs.m_next; lp; lp = lp->m_next) + if (lp->m_bcc) + allbcc = allbcc? add( + concat(", ", lp->m_mbox, "@", lp->m_host, NULL), + allbcc) + : concat(lp->m_mbox, "@", lp->m_host, NULL); + if (allbcc) + { + fprintf (out, "BCC: %s\n",allbcc); + free(allbcc); + } + } + else + { + fprintf (out, "BCC:\n"); + } /* * Use MIME encapsulation for Bcc messages