]> diplodocus.org Git - nmh/commitdiff
- Fixed bcc to work with sendmail/pipe [Bug 55700].
authorAlexander Zangerl <exmh@bin.snafu.priv.at>
Sun, 9 Jun 2019 15:40:38 +0000 (11:40 -0400)
committerDavid Levine <levinedl@acm.org>
Sun, 9 Jun 2019 15:40:38 +0000 (11:40 -0400)
And better documented that dcc doesn't work with sendmail/pipe.

docs/pending-release-notes
man/post.man
man/send.man
test/fakesendmail
test/post/test-mts
uip/post.c

index 3db7924dab1f75c27b1a4fead548bc532176d937..a5b0f223bc089750ef9467fb6500e9d02bd2febb 100644 (file)
@@ -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
index e49d10bfef67e5daffb87f86b591ad961fb2f966..39e66f60855245da2f93f7b13904f4c01a8541b2 100644 (file)
@@ -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
index 383f8c49dfd55e7ceaf5b78c8da065d7709f9a20..a57ff48bf220921c0ea235adc9858e7e947803e7 100644 (file)
@@ -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
index 37b6e309edb918c4799ce34d133792542a0bf05f..81b976203ab7651b0f655fd21ce4607cc26c072a 100755 (executable)
@@ -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
index cd0e727dc30442dc4d02f6be924dcf71cfb046c4..0f0c2a0870078179283350492889a7799d012b9c 100755 (executable)
@@ -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" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
@@ -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" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
@@ -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" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
@@ -159,6 +166,7 @@ cat > "${testname}.expected2" <<EOF
 From: Mr Nobody <nobody@example.com>
 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" <<EOF
+From: nobody@example.com
+Dcc: dcc@example.com
+
+.
+EOF
+
+cat > "${testname}.expected1" <<EOF
+post: Dcc header is not supported with sendmail/pipe
+post: re-format message and try again
+send: message not delivered to anyone
+EOF
+
+! test_sendmail sendmail/pipe 2>"${testname}.actual1"
+check "${testname}.actual1" "${testname}.expected1"
+
 rm -f ${MHMTSCONF}
 
+finish_test
 exit ${failed:-0}
index c36f43aa1d8ee7c369c1a07ec8233d3c8f8d079a..cf2ccf835c5a851cb525db3e2b9c97bbc61640bf 100644 (file)
@@ -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