🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #46190

Re: null characters

#46190
From: Curt Welch
Date: Sat, 29 Apr 2000 00:00
72 lines
4474 bytes
mouse@NOSPAM.nibble.net (Steve Walker) wrote:
> Hello everyone,
>
> I was wondering does the NNTP protocol allow null characters to be
> embedded in articles?

Sure.  But the real question is whether USEFOR and the other article
format RFCs say it's ok.

> If so, does anyone see a problem with striping
> them?

Never modify the article like that.  Either deal with it, or reject it.
There are people who believe articles should be allowed to conatin nulls
(in the body at least).  One day that might be "valid" and you don't want
your server corrupting them as they pass by.

And your code which parses the NNTP stream needs to be able to deal with
nulls because there are lots of articles which have them today.  I cross
post all articles with nulls in them to local.nulls and the group currently
contains 16000 articles (for a 2wk period).

> I finally tracked down a problem with earthquake getting out of sync
> while accepting a feed.  It seems some of my news peers are sending
> null characters which cause problems with string functions like
> strcmp.

I took great pains to make sure all my header and article parsing code
could deal with nulls (and all 8-bit data).  I don't use C-style strings to
store any of the raw article information and I don't use functions like
strcmp until the data has been extracted from the headers and is known not
to contain nulls.

In my opinion, an NNTP tranist server should be able to receive, and
re-transmit any article without changing it at all (other than the Path:
header and an optional Xref: header).  If it decides to reject certain
articles after they are received because they don't meet certain standards,
that's fine, but if it decides to re-transmit the article to a peer, then
it MUST do it without changing a single byte.  So from this point of view,
on the NNTP data stream, an article is either 0 bytes terminated with DOT
CR LF, or 1 or more 8 bit bytes terminated with CR LF DOT CR LF.  And when
that article is re-transmitted, it should be byte-for-byte identical to how
it was received.  That includes all possible 8 bit values including NULLs
and CRs or LFs in any combination.  So an article that contains CR LF LF LF
CR CR CR CR LF CR etc. should be re-transmitted byte for byte exactly like
it was received.  Header lines should not be "cleaned up" or reformated in
any way, etc.

And, an article that contains an invalid single leading DOT on a line
should also be re-transmitted exactly like it was received, or it should be
rejected. Do NOT strip leading dots off the lines on incomming articles
without checking to make sure the next character on the line is a DOT as
well.  New articles being POSTED to the server should always be checked for
this bug and should be rejected if it's detected.

There are newsreaders which uuencode data without doing the leading DOT
encoding like it should.  But the last data line of a uuencoded file can
begin with a DOT if the file length happens to be correct.  But it might
also just happen to begin with multiple dots instead of only one.

There are other newsreaders/decoding programs which look for this bug and
try to correct for it -- but if your transit server starts stripping off
leading dots and not putting them back on as it passes though, then
that makes things even worse.  It's bad enough that the article was
allowed onto Usenet by the first newsreader/news server, but it causes
even more problems if it gets modified even further with each hop.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/

Technical Details
Message-ID: <20000429023841.446$kG@newsreader.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.mbox.zip!not-for-mail
References: <390a764e.356264270@news.nntpserver.com>

Show Full Headers
Complete Article Headers
Message-ID: <20000429023841.446$kG@newsreader.com>
Subject: Re: null characters
Date: Sat, 29 Apr 2000 00:00:00 +0000
From: curt@kcwc.com (Curt Welch)
References: <390a764e.356264270@news.nntpserver.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.mbox.zip!not-for-mail
X-Deja-AN: 617093401
X-User: Curt@NewsReader.Com
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5 %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
Organization: NewsReader.Com
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Newsgroups: news.software.nntp