trusteddomainproject / OpenDKIM

Other
97 stars 52 forks source link

Body with specified length doesn't end with CRLF will trigger 'CRLF at end of body missing' #45

Open mars90226 opened 5 years ago

mars90226 commented 5 years ago

OpenDKIM will only receive message body with length specified in DKIM signature (l=), and reply SMFIS_SKIP to MTA. Thus, the body does not have to be ended with CRLF and should not trigger CRLF at end of body missing if CRLF is not exist.

According to the section 3.7 of RFC6376,

the Signer/Verifier MUST hash the message body,
   canonicalized using the body canonicalization algorithm specified in
   the "c=" tag and then truncated to the length specified in the "l="
   tag.

In addition to that, the "simple" and "relaxed" body canonicalization algorithm both suggest that if body is not empty and have no trailing CRLF, a CRLF is added. So, OpenDKIM should just append a CRLF to the body if body doesn't end with CRLF.

I suggest that this if-else block should be replaced by the if block.

mskucherawy commented 5 years ago

You're mostly right. This should still be an error when "l=" wasn't used in the signature.

mars90226 commented 5 years ago

Ah, yes. When the whole body is not actually ended with CRLF and there isn't l= in signature, OpenDKIM should throw syntax error. Otherwise, OpenDKIM should not care about CRLF at the end of body.