Re: [ietf-822] [Editorial Errata Reported] RFC5322 (3400)

Keith Moore <moore@network-heretics.com> Wed, 28 November 2012 07:01 UTC

Return-Path: <moore@network-heretics.com>
X-Original-To: ietf-822@ietfa.amsl.com
Delivered-To: ietf-822@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 52B5821F861C for <ietf-822@ietfa.amsl.com>; Tue, 27 Nov 2012 23:01:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.598
X-Spam-Level:
X-Spam-Status: No, score=-3.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4e33Uixy8ld0 for <ietf-822@ietfa.amsl.com>; Tue, 27 Nov 2012 23:01:39 -0800 (PST)
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by ietfa.amsl.com (Postfix) with ESMTP id CEB1421F85CE for <ietf-822@ietf.org>; Tue, 27 Nov 2012 23:01:38 -0800 (PST)
Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 0095720C30 for <ietf-822@ietf.org>; Wed, 28 Nov 2012 02:01:37 -0500 (EST)
Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 28 Nov 2012 02:01:37 -0500
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:references:in-reply-to:content-type; s=smtpout; bh=8LPC Rau6xAgId5EW4huvwUi2CTM=; b=ktL93CcEVUeAZuIzUqmWDy352vFTjLNAH4Kf tVzM/ZFd8OjHYZyrubtnZwr+ESL/tg8yQS0UbqcHnxnvaIATGHSUg5bfp0XCm5vN 0IaNtnG1J+cNIr1iOIm99KgU+sS8GvRMSRF9pVjWqpX6+oB5PHY0jfNieUVhZ+9a FvlKxIE=
X-Sasl-enc: oraVjonNMsQCamWbobO1Yq9dg7piXobn0gpWWXtVRQF2 1354086096
Received: from [192.168.1.20] (unknown [65.16.145.177]) by mail.messagingengine.com (Postfix) with ESMTPA id D4C3A482744; Wed, 28 Nov 2012 02:01:35 -0500 (EST)
Message-ID: <50B5B6AA.3060003@network-heretics.com>
Date: Wed, 28 Nov 2012 02:00:58 -0500
From: Keith Moore <moore@network-heretics.com>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: ietf-822@ietf.org
References: <20121107020448.E2B9BB1E003@rfc-editor.org> <50B54668.4050006@qti.qualcomm.com>
In-Reply-To: <50B54668.4050006@qti.qualcomm.com>
Content-Type: multipart/alternative; boundary="------------040601070805020509030401"
Subject: Re: [ietf-822] [Editorial Errata Reported] RFC5322 (3400)
X-BeenThere: ietf-822@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "Discussion of issues related to Internet Message Format \[RFC 822, RFC 2822, RFC 5322\]" <ietf-822.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf-822>, <mailto:ietf-822-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/ietf-822>
List-Post: <mailto:ietf-822@ietf.org>
List-Help: <mailto:ietf-822-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf-822>, <mailto:ietf-822-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Nov 2012 07:01:40 -0000

IMO:

1. A message can be legal without a CRLF at the end.   However,

2. If the message doesn't end with CRLF, there's no way to transfer it 
using SMTP /DATA/ without modifying the message.   (note the emphasis on 
DATA)

3.  Similarly, any message received via SMTP DATA already has a CRLF at 
the end, so there's no ambiguity concerning the last line of a message 
when dealing with any message received using SMTP DATA.  The receiver 
has to assume that the terminating CRLF (before the '.CRLF') was part of 
the original message.

4. A message not ending in CRLF could be transmitted via other means, 
e.g. using SMTP BDAT if the MTA supports it, or any other suitable 
message transfer protocol.   More generally, use of Internet Message 
Format is not limited to SMTP.

However, if the receiving MTA then tried to relay the message to another 
MTA that didn't support BDAT, or to relay or deliver it to any 
environment (e.g. mbox format) that expected messages to consist 
entirely of terminated lines of text, results are more-or-less 
undefined.   The message could be modified to cause it to end in a 
terminated line (with or without changing the content represented by the 
message), or it could be bounced.

Note that there are corner cases where simply appending CRLF could do 
harm, e.g. a MIME message consisting of a single quoted-printable body 
part and a filename specified via the Content-Disposition header field - 
e.g. some sort of application-specific data that needed to be preserved 
end-to-end. In such a case it would make more sense to re-encode the 
message body in base64 than to simply append a CRLF.   But this seems 
out-of-scope for 5321.   If anything needs an erratum explaining this, 
it's RFC 3030.

Conclusions:

1. It seems reasonable to add an erratum to 5322 recommending that 
messages, as originated, end in CRLF, unless it is known that the 
message can be transmitted from sender-to-recipient without loss of full 
binary transparency.

(Note that there are lots of things that are perfectly valid according 
to 5322 which are unlikely to work well in practice, and which would 
probably also be recommended against if anyone took the trouble to try 
to identify them and file errata for them.)

2. It's reasonable, during mail submission only, for a submission server 
or MTA to EITHER adapt a message that doesn't end in CRLF so that it 
does, OR bounce the message, according to local policy.   But as far as 
SMTP is concerned, this is only relevant if BDAT is used to submit the 
message.   So it's really not in scope for RFC 5321.

3. When relaying mail (past the first hop), the issue comes up only when 
either BDAT or a nonstandard protocol or protocol extension are used.    
So again, it's not in scope for 5321.

4. It might be worthwhile to examine RFC 3030 for errata along these lines.

Keith

On 11/27/2012 06:02 PM, Pete Resnick wrote:
> [Bcc'ed to ietf-smtp@ietf.org; please discuss over on ietf-822@ietf.org.]
>
> Folks,
>
> The following erratum was posted for 5322. I'm inclined to reject it 
> since this discussion actually took place during DRUMS (17-18 March 
> 1998 in a thread with a subject of "Small Clarification to msg-fmt-04" 
> if you are inclined to look) and the consensus outcome as far as I 
> could tell (as document editor) was that messages without a final CRLF 
> were SMTP's problem. However, 5321 (and 2821) 4.1.1.4 says:
>
>    The mail data are terminated by a line containing only a period, that
>    is, the character sequence "<CRLF>.<CRLF>", where the first <CRLF> is
>    actually the terminator of the previous line (see Section 4.5.2).
>    This is the end of mail data indication.  The first <CRLF> of this
>    terminating sequence is also the <CRLF> that ends the final line of
>    the data (message text) or, if there was no mail data, ends the DATA
>    command itself (the "no mail data" case does not conform to this
>    specification since it would require that neither the trace header
>    fields required by this specification nor the message header section
>    required by RFC 5322 [4] be transmitted).  An extra <CRLF> MUST NOT
>    be added, as that would cause an empty line to be added to the
>    message.  The only exception to this rule would arise if the message
>    body were passed to the originating SMTP-sender with a final "line"
>    that did not end in <CRLF>; in that case, the originating SMTP system
>    MUST either reject the message as invalid or add <CRLF> in order to
>    have the receiving SMTP server recognize the "end of data" condition.
>
> Allowing the originating SMTP system to reject the message as invalid 
> seems in conflict with 5322 on this point. So my rejecting this 
> erratum will simply end us up with an erratum against 5321.
>
> I'm inclined to hear opinions.
>
> pr
>
>> The following errata report has been submitted for RFC5322,
>> "Internet Message Format".
>>
>> --------------------------------------
>> You may review the report below and at:
>> http://www.rfc-editor.org/errata_search.php?rfc=5322&eid=3400
>>
>> --------------------------------------
>> Type: Editorial
>> Reported by: Christoph Anton Mitterer<calestyo@scientia.net>
>>
>> Section: 3.5.
>>
>> Original Text
>> -------------
>>     message         =   (fields / obs-fields)
>>                         [CRLF body]
>>
>>     body            =   (*(*998text CRLF) *998text) / obs-body
>>
>>
>> Corrected Text
>> --------------
>>     message         =   (fields / obs-fields)
>>                         [CRLF body]
>>
>>     body            =   (*(*998text CRLF) *998text) / obs-body
>>
>> It is RECOMMENDED that message bodies are terminated by CRLF, though 
>> this is in principle not necessary (this does not apply to messages 
>> consisting only of a header section, as header fields are always CRLF 
>> terminated).
>>
>> Note however, that when transporting messages via SMTP the last lines 
>> of message bodies MUST be terminated by CRLF as specified int RFC 
>> 5321, section 4.1.1.4.
>>
>> Notes
>> -----
>> Hi folks.
>>
>> AFAIU, the definition of body allows message bodies (not header 
>> sections) that end without CRLF.
>>
>> RFC5321 section 4.1.1.4. however states: "The mail data are 
>> terminated by a line containing only a period, that is, the character 
>> sequence "<CRLF>.<CRLF>", where the first<CRLF>  is actually the 
>> terminator of the previous line".
>>
>> So SMTP forbids, what this RFC allows.
>> I guess the SMTP RFC can't be changed here and it makes no particular 
>> sense to restrict RFC5322 on the other hand.
>>
>> My suggestion was to add this clarification.
>>
>> Perhaps a similar one should be added to RFC5321, telling that 
>> Internet Messages themselves wouldn't need the last CRLF.
>>
>> Instructions:
>> -------------
>> This errata is currently posted as "Reported". If necessary, please
>> use "Reply All" to discuss whether it should be verified or
>> rejected. When a decision is reached, the verifying party (IESG)
>> can log in to change the status and edit the report, if necessary.
>>
>> --------------------------------------
>> RFC5322 (draft-resnick-2822upd-06)
>> --------------------------------------
>> Title               : Internet Message Format
>> Publication Date    : October 2008
>> Author(s)           : P. Resnick, Ed.
>> Category            : DRAFT STANDARD
>> Source              : IETF - NON WORKING GROUP
>> Area                : N/A
>> Stream              : IETF
>> Verifying Party     : IESG
>