Wietse Venema:
> > I added "message_strip_characters = \0" to my Postfix's main.cf and did
> > a reload of Postfix, but this doesn't seem to have had any effect on the
> > problem.  I did a Google search and found various complaints over the
> > years from people claiming "message_strip_characters = \0" didn't work
> > for them, but there didn't seem to be any obvious answer.

I just did the following:

    $ ls -la > file

This produces a file with lines such as 

    -rw-------    1 wietse  wietse        16 Feb 11  2010 .esd_auth

When I send this with "b" replaced by null:

    tr 'b' '\0' < file | sendmail wietse@localhost

This delivers a message with nulls in the body content. For example,
when viewed with less, "Feb" becomes "Fe^@" where ^@ is ASCII nul:

    -rw-------    1 wietse  wietse        16 Fe^@ 11  2010 .esd_auth

When I have this in main.cf:

    $ postconf message_strip_characters
    message_strip_characters = \0

Then, the same message is delivered without the nulls. For example,
I now get "Fe" instead of "Fe^@":

    -rw-------    1 wietse  wietse        16 Fe 11  2010 .esd_auth

So I suspect that this is a case of user error: you are trying to
strip null characters from MIME ENCODED email, and as documented,
body_checks doesn't decode MIME. 

In quoted-printable encoding, null characters look like:

        =00

And in Base64-encoded email, embedded nulls look different
depending on their position in the file.

Using body_checks for this is unsafe, since body_checks doesn't
know if a message is MIME encoded. Doing that properly requires a
MIME parser.

So the answer is, to remove null characters from MIME-ENCODED
email, you need a MIME-aware filter, instread of body_checks.

        Wietse

Reply via email to