msd+postfix-us...@msd.im:
> Hi all,
> 
> With `milter_protocol = 2`, the DKIM signature is invalid if a signed
> header is like "Subject:" in this test.eml attached example.
> 
> ```
> From: <t...@example.com>
> To: <t...@example.com>
> Subject:
>  
> Folding_White_Space_and_too_long_subject_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> 
> Test
> ```
> 
> It works fine with `milter_protocol = 6`.

Which is the default value.

Milter protocols versions < 6 don't support the SMFIP_HDR_LEADSPC
feature. This feature was introduced with Sendmail 8.14, and is
needed to correctly preserve the leading whitespace of a header
field value.

        Wietse

Sendmail 8.14.0 RELEASE_NOTES:
        LIBMILTER: A milter can receive header field values with all
                leading spaces by requesting the SMFIP_HDR_LEADSPC
                protocol action.  Also, if the flag is set then the MTA
                does not add a leading space to headers that are added,
                inserted, or replaced.

sendmail-8.14.0/libmilter/docs/xxfi_header.html:
    Starting with sendmail 8.14, spaces after the colon in a header
    field are preserved if requested using the flag SMFIP_HDR_LEADSPC.
    That is, the header

    From: sender <f...@example.com>
    To:  user <t...@example.com>
    Subject:no

    will be sent to a milter as

    "From", " sender <f...@example.com>"
    "To", "  user <t...@example.com>"
    "Subject", "no"

    while previously (or without the flag SMFIP_HDR_LEADSPC) it was:

    "From", "sender <f...@example.com>"
    "To", "user <t...@example.com>"
    "Subject", "no"

In the implementation, Sendmail skips only the first space character
before a header value, so the documentation and code disagree.
Postfix implements Sendmail behavior.

Reply via email to