🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #87522

Re: Multiple occurences of header fields

#87522
From: Adam H. Kerman
Date: Sun, 04 Sep 2016 21:02
106 lines
5722 bytes
Julien <iulius@nom-de-mon-site.com.invalid> wrote:

>Hi Adam,

>>>       Compliant software MUST NOT generate (but MAY accept) header field
>>>       lines of more than 998 octets.  This is the only limit on the
>>>       length of a header field line prescribed by this standard.
>>>       However, specific rules to the contrary may apply in particular
>>>       cases (for example, according to [RFC2047], lines of a header
>>>       field containing encoded words are limited to 76 octets).

>>> => The check for 998 octets is already done, but not the one for 76 octets!
>>> As INN does not generate such headers, I believe it is OK not to check
>>> the length of header fields containing encoded words (an injecting agent
>>> MAY accept them).

>> Once the encoding is added, you can end up displaying a rather short line.
>> Is it 76 because a longer line is thought to interfere with decoding?

>Section 2 of RFC 2047 gives the following rationale for this limitation:

>    An 'encoded-word' may not be more than 75 characters long, including
>    'charset', 'encoding', 'encoded-text', and delimiters.  If it is
>    desirable to encode more text than will fit in an 'encoded-word' of
>    75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may
>    be used.

So a line break in the middle of the encoded word is thought to interfere
with decoding?

>    While there is no limit to the length of a multiple-line header
>    field, each line of a header field that contains one or more
>    'encoded-word's is limited to 76 characters.

>    The length restrictions are included both to ease interoperability
>    through internetwork mail gateways, and to impose a limit on the
>    amount of lookahead a header parser must employ (while looking for a
>    final ?= delimiter) before it can decide whether a token is an
>    "encoded-word" or something else.

Ok, thanks.

>>>    o  The character set for header fields is US-ASCII.  Where the use of
>>>       non-ASCII characters is required, they MUST be encoded using the
>>>       MIME mechanisms defined in [RFC2047] and [RFC2231].

>>> => This check is currently not done.  I suggest to do nothing about it
>>> because it will otherwise probably do harm when receiving
>>> "internationalized" header fields (for instance encoded in UTF-8).

>> It sounds like a worthwhile sanity check to perform.

>The problem with such a check is that INN would reject current valid 
>articles.  We already have UTF-8 chars in wide in a few circumstances, 
>especially for internationalized newsgroup names.
>There's a sentence about that in RFC 5536, Section 4:  "Note that the 
>generation of internationalized <newsgroup-name>s for use in header 
>fields is not addressed in this document."

I guess you could check the other fields.

>> Does References already get checked for a string of valid Message-IDs too,
>> or just the Message-ID getting appended?

>INN currently does not check anything about the References: header 
>field.  I agree it should do something (list of valid Message-IDs).

How about a check for strings in Message-ID syntax?

I shouldn't have suggested "valid", as that's a hell of a lot of processing.

>However, a news server cannot check whether all Message-IDs corresponds 
>to a/ existing articles and b/ articles in the same thread because it 
>does not necessarily have the information (notably if an article did not 
>reach the news server or if the news server just do not store 
>information about articles it just re-feds).

I didn't mean to suggest doing that.

>>I have no idea how Distribution could possibly be checked beyond
>>disallowed character

>I suggest to just check that it conforms to the expected syntax:

>dist-list       =  *WSP dist-name
>                       *( [FWS] "," [FWS] dist-name ) *WSP

>dist-name       =  ALPHA / DIGIT
>                       *( ALPHA / DIGIT / "+" / "-" / "_" )

>and that "all" is not present (it is a MUST NOT per RFC 5536, Section 
>3.2.4).

That makes good sense.

Here's something I don't know: How does a News server or newsreader
learn of valid distributions? Is there a a file that a newsreader
would typically download?

Or was the assumption all along that every user would just know
what the distributions were?

I can't recall the last time I saw an article that used the Distribution
header.

Technical Details
Message-ID: <nqi262$oj3$1@news.albasani.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
References: <2116899503.484444288.248931.dunno-dunno.dunno@news.mixmin.net> <ni2afm$96b$1@news.trigofacile.com> <nqhfo8$nvl$1@news.albasani.net> <nqhtcb$8h7$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <nqi262$oj3$1@news.albasani.net>
Subject: Re: Multiple occurences of header fields
Date: Sun, 04 Sep 2016 21:02:58 +0000
From: "Adam H. Kerman" <ahk@chinet.com>
References: <2116899503.484444288.248931.dunno-dunno.dunno@news.mixmin.net> <ni2afm$96b$1@news.trigofacile.com> <nqhfo8$nvl$1@news.albasani.net> <nqhtcb$8h7$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
Newsgroups: news.software.nntp
Organization: albasani.net
Lines: 104
X-Trace: news.albasani.net QViPRFmmZnz2wf5bKf+0+kNjQzdxn3zFT3QjmEtyRwwYySaLYG+xGg4dm19b0D+OYMQZCz8+WFAsA1QdJskcfWEt+fub6y/ZjSSNtX2IZKS09RncAEWLbIHBOmC0Jfps
NNTP-Posting-Date: Sun, 4 Sep 2016 21:02:58 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="SaPIYkTN7hzLCgfcW1QRJkG60fFg0UenwEXmWPiWlstzLXPYDRNxfWgOedawq/nxJ3Ns0rG9Iv6L2A3D0ElcwN665t8USmjbBPyK0BBpyiueIJVOohwPeQY2hfzku4Jg"; mail-complaints-to="abuse@albasani.net"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Cancel-Lock: sha1:odkXfbjdnuVULsIut+G+cZRGz18=
X-Received-Bytes: 5537
X-Received-Body-CRC: 2258780331