diff -Nru nmh-1.7.1/debian/changelog nmh-1.7.1/debian/changelog --- nmh-1.7.1/debian/changelog 2018-12-27 12:15:54.000000000 +0000 +++ nmh-1.7.1/debian/changelog 2019-02-12 04:58:31.000000000 +0000 @@ -1,3 +1,9 @@ +nmh (1.7.1-4) unstable; urgency=high + + * fix bcc: handling for mts sendmail/pipe (closes: #921244) + + -- Alexander Zangerl Tue, 12 Feb 2019 14:58:31 +1000 + nmh (1.7.1-3) unstable; urgency=high * applied upstream commit that restores password handling diff -Nru nmh-1.7.1/debian/patches/15-bcc-pipe nmh-1.7.1/debian/patches/15-bcc-pipe --- nmh-1.7.1/debian/patches/15-bcc-pipe 1970-01-01 00:00:00.000000000 +0000 +++ nmh-1.7.1/debian/patches/15-bcc-pipe 2019-02-12 04:58:31.000000000 +0000 @@ -0,0 +1,150 @@ +Description: fix bcc/dcc handling for mts sendmail/pipe + patch makes bcc behave the same regardless of mts config, + and messages with dcc are now rejected with mts sendmail/pipe. + manpages for send and post slightly updated and clarified. +Author: Alexander Zangerl +Bug: https://bugs.debian.org/921244 +Bug: https://savannah.nongnu.org/bugs/?55700 + +--- a/uip/post.c ++++ b/uip/post.c +@@ -848,6 +848,12 @@ putfmt (char *name, char *str, int *eai, + badmsg++; + return; + } ++ if (hdr->flags & HDCC && sm_mts == MTS_SENDMAIL_PIPE) ++ { ++ inform("Dcc header is not supported with sendmail/pipe"); ++ badmsg++; ++ return; ++ } + msgflags |= (hdr->set & ~(MVIS | MINV)); + + if (hdr->flags & HSUB) +@@ -1242,8 +1248,7 @@ putadr (char *name, char *aka, struct ma + + 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) { +@@ -1475,7 +1480,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 +--- 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 all messages that contain a \*(lqDcc:\*(rq field if the ++.B sendmail/pipe ++mail transport method is used. ++.PP + The + .B \-alias + .I aliasfile +--- a/man/send.man ++++ b/man/send.man +@@ -257,14 +257,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 +@@ -277,6 +279,12 @@ it takes extra effort in most mailers to + 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 + .I filterfile diff -Nru nmh-1.7.1/debian/patches/series nmh-1.7.1/debian/patches/series --- nmh-1.7.1/debian/patches/series 2018-12-27 11:59:21.000000000 +0000 +++ nmh-1.7.1/debian/patches/series 2019-02-12 04:58:31.000000000 +0000 @@ -9,3 +9,4 @@ 12-welcome 13-oauth 14-legacycreds +15-bcc-pipe