This patch is a temporary partial possible fix, not the best solution better to strip space just from only appropriate header lines, but also from mime lines in body. should apply to all of: headers.c.REL=6.2-RELEASE.diff headers.c.REL=7.1-RELEASE.diff@ headers.c.REL=7.2-RELEASE.diff@S Not needed for FreeBSD=8.1-RC2 & 7.3-RELEASE, as someone has applied a similar patch. Notes ./contrib/sendmail/RELEASE_NOTES ./contrib/sendmail/src/deliver.c ./contrib/sendmail/src/mime.c: "X-MIME-Autoconverted: from %.200s to 8bit by %s id %s", Unsent Draft ------------------- To: Majordomo-Users@@greatcircle.com cc: "Per Hedeland" , Leo Subject: Re: X-MIME-Autoconverted: from quoted-printable to 8bit by majordomo-server From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany Fcc: sent User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Wed, 15 Jul 2009 23:57:47 +0200." <200907152157.n6FLvlWN043768@@fire.js.berklix.net> Hi Majordomo-Users@@greatcircle.com, replying to myself for archive (as no answers from Majordomo-Users@@greatcircle.com) (But I see my question asked by myself & others via search engine) Reference: > From: "Julian H. Stacey" > Date: Wed, 15 Jul 2009 23:57:47 +0200 > Message-id: <200907152157.n6FLvlWN043768@@fire.js.berklix.net> "Julian H. Stacey" wrote: > Hi Majordomo-Users@@greatcircle.com, > A sendmail question more than majodomo, but not sure where to ask: > My majordomo works so well, adding to header: > X-MIME-Autoconverted: from quoted-printable to 8bit by majordomo-server > > I'd like that conversion on other mail through my servers, to obviate > quoted-printable & base64 junk excretia (& not on a per user or > MIME enclosure basis, but host wide, mail wide, - & I presume I > don't need mimedefang as majordomo already does it without) > > How ? I went investigating what majodomo is doing on my remote > FreeBSD-6.2, to import whatever 'domo does so nicely also to my > my desk top FreeBSD-7.1, but I can't find what to import ? > Here's a summary I wrote while searching: > > In header of a mail someone sent a majordomo list I run: > MIME-Version: 1.0 > Content-Disposition: inline > Content-Type: text/plain; > charset="utf-8" > Content-Transfer-Encoding: 8bit > X-MIME-Autoconverted: from quoted-printable to 8bit by ..... > > [ no match in majordomo sources so ...] > On remote FreeBSD-6.server source: > > cd /usr/src/contrib/sendmail/src > vi -c/\^mime7to8 mime.c > /X-MIME-Autoconverted: from %.200s to 8bit by %s id %s > > vi -c/mime7to8 `grep -l mime7to8 *` # Find what calls it. > > vi -c/\^do_transfer deliver.c # Caller > /mime7to8 > > vi /etc/make.conf # Check MIME7TO8 is turned on > # CFLAGS += -DMIME7TO8 > # On by default in > # /usr/src/contrib/sendmail/src/conf.h > # so does not change content of > # /usr/obj/usr/src/usr.sbin/sendmail/deliver.o > # with > # cd /usr/src/usr.sbin/sendmail ; make > > I see /var/log/maillog on remote server reports features to other end inc.: > Jul 15 06:00:21 flat sm-mta[86718]: n6F40LPE086718: --- 250-8BITMIME > & my local desk top does too: > Jul 14 14:00:01 fire sm-mta[10257]: n6EC01hh010257: --- 250-8BITMIME > > deliver.c: > if (bitnset(M_MAKE8BIT, m->m_flags) && > > sendmail.h: > struct mailer > { ... > BITMAP256 m_flags; /* status flags, see below */ > ... } > /* bits for m_flags */ > #define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */ > > grep m_flags * | grep M_MAKE8BIT > deliver.c: if (bitnset(M_MAKE8BIT, m->m_flags) && > deliver.c: if (bitnset(M_MAKE8BIT, mailer->m_flags) && > > sendmail.cf > host=server : # FreeBSD-6.2 > # strip message body to 7 bits on input? > O SevenBitInput=False > # 8-bit data handling > #O EightBitMode=pass8 > host=desk top : # FreeBSD-7.1 > # strip message body to 7 bits on input? > O SevenBitInput=False > # 8-bit data handling > #O EightBitMode=pass8 > Same on both. > > Any ideas, hints, RTFM URLs ? I found: http://objectmix.com/sendmail/601934-upgrade-8-14-2-stops-automatic-mime-conversion-8-bit.html From "Per Hedeland" cc'd ] Leo writes: ] >Before upgrading from 8.13.6 MIME message bodies would be converted to ] >8-bit as per the F=9 delivery agent flag with the default delivery ] >agents. (Seen by the addition of the "X-MIME-Autoconverted: from ] >quoted-printable to 8bit by" header in the e.g. below.) ] > ] >After upgrading to 8.14.2 the automatic conversion to 8-bit of quoted- ] >printable or base64 message bodies seems to have stopped. (No X-MIME ] >header in the e.g. below.) ] ] This bug was introduced by this (pretty useless IMO) change in 8.14.0: ] ] Preserve spaces after the colon in a header. Previously, any ] number of spaces after the colon would be changed to ] exactly one space. ] ] The bug comes about because the code checking the header values does not ] take the now present space(s) into account. And from a quick browse of ] other parts of the code that use header values, it seems that the change ] has also introduced a whole bunch of other bugs. ] ] The patch below fixes the problem for 7-to-8 conversion, and probably ] most of the other cases that got broken by the change above - but may ] possibly introduce some other bug and/or in some cases undo the change. ] Use at your own risk (I'm doing it:-). ] ] --Per Hedeland ] per@@hedeland.org ] ] --- sendmail-8.14.2/sendmail/headers.c.ORIG 2007-06-19 20:52:11.000000000 +0200 ] +++ sendmail-8.14.2/sendmail/headers.c 2008-07-09 14:57:48.000000000 +0200 ] @@ -714,8 +714,12 @@ ] for (h = header; h != NULL; h = h->h_link) ] { ] if (!bitset(H_DEFAULT, h->h_flags) && ] - sm_strcasecmp(h->h_field, field) == 0) ] - return h->h_value; ] + sm_strcasecmp(h->h_field, field) == 0) { ] + char *p = h->h_value; ] + while (isascii(*p) && isspace(*p)) ] + p++; ] + return p; ] + } ] } ] return NULL; ] } I also noted: My 2 remote servers are: My majordomo server FreeBSD-6.2 Sendmail-8.13.8 Router of some mail to my majordomo: FreeBSD-6.3 Sendmail-8.14.2 My desktop (FreeBSD-7.1-RELEASE) `sendmail -d0.1` is 8.14.3 & so is FreeBSD-7.2-RELEASE, & so is FreeBSD-7.1/usr/ports/mail/sendmail/work/sendmail-8.14.3 & so is /pri/FreeBSD/branches/amd64/-current/ports/mail/sendmail & http://www.sendmail.org lists nothing beyond 2008-05-03 Sendmail 8.14.3 So no new sources to upgrade to, so I looked at patch (which had lost tabs on that site, new diff -c below) & though about it. It seems plausible. I'll now run it for a while. *** FreeBSD-7.1+Sendmail-8.14.2/src/contrib/sendmail/src/headers.c Sat Aug 30 02:20:49 2008 --- new-generic/src/contrib/sendmail/src/headers.c Fri Jul 24 01:45:23 2009 *************** *** 714,721 **** --- 714,741 ---- for (h = header; h != NULL; h = h->h_link) { if (!bitset(H_DEFAULT, h->h_flags) && + #ifdef ORIGINAL_8_14_2 sm_strcasecmp(h->h_field, field) == 0) return h->h_value; + #else + /* + ** From "Per Hedeland" + ** http://objectmix.com/sendmail/601934-upgrade-8-14-2-stops-automatic-mime-conversion-8-bit.html + */ + sm_strcasecmp(h->h_field, field) == 0) { + char *p = h->h_value; + while (isascii(*p) && isspace(*p)) + /* + ** Q. from jhs@@berklix.com: why not just isspace(*p) + ** Is it to force a break on an 8 bit space + ** (if such exists in some Locales ?) + ** isascii() tests for any character between 0 and octal 0177 + ** isspace non-zero if the character tests true + */ + p++; + return p; + } + #endif } return NULL; } Cheers, Julian -- Julian Stacey: BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail in plain ASCII text; HTML & Base64 are spam. http://asciiribbon.org