Re: [exim-dev] Delivering message to Exim via SMTPS with LF …

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Philip Hazel
日付:  
To: Steven Chamberlain
CC: Exim-dev, Renaud Allard
題目: Re: [exim-dev] Delivering message to Exim via SMTPS with LF instead of CRLF, breaks DK validator
On Fri, 11 Jul 2008, Steven Chamberlain wrote:

> Though I still wonder if Exim contravenes the RFC by accepting the SMTP
> commands which I sent with LF instead of CRLF line endings. Perhaps a
> decision was made to allow LF line endings for SMTP commands (e.g. for
> compatibility)?


Here is a quote from the Exim specification (which you can find by
looking up "line endings" in the index):

44.2 Line endings

RFC 2821 specifies that CRLF (two characters: carriage-return,
followed by linefeed) is the line ending for messages transmitted over
the Internet using SMTP over TCP/IP. However, within individual
operating systems, different conventions are used. For example,
Unix-like systems use just LF, but others use CRLF or just CR.

Exim was designed for Unix-like systems, and internally, it stores
messages using the system's convention of a single LF as a line
terminator. When receiving a message, all line endings are translated
to this standard format. Originally, it was thought that programs that
passed messages directly to an MTA within an operating system would
use that system's convention. Experience has shown that this is not
the case; for example, there are Unix applications that use CRLF in
this circumstance. For this reason, and for compatibility with other
MTAs, the way Exim handles line endings for all messages is now as
follows:

    * LF not preceded by CR is treated as a line ending.


    * CR is treated as a line ending; if it is immediately followed by
      LF, the LF is ignored.


    * The sequence "CR, dot, CR" does not terminate an incoming SMTP
      message, nor a local message in the state where a line
      containing only a dot is a terminator.


    * If a bare CR is encountered within a header line, an extra space
      is added after the line terminator so as not to end the header
      line. The reasoning behind this is that bare CRs in header lines
      are most likely either to be mistakes, or people trying to play
      silly games.


    * If the first header line received in a message ends with CRLF, a
      subsequent bare LF in a header line is treated in the same way
      as a bare CR in a header line.


This "policy" developed over several years after Exim was first
implemented as a result of a number of problems that were encountered
(including, IIRC, SMTP implementations that used only LF). Some of the
history might be found by trawling the ChangeLogs, if anyone wants more
detail.

However, it was all some time ago now. Perhaps it is time to review?
(But not by me. :-)

Philip

--
Philip Hazel