🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #63152

Re: NNTP and YENC

#63152
From: Bart Crane
Date: Wed, 15 Jan 2003 02:20
290 lines
12446 bytes
Rene <invalid@email.addr> wrote in message
news:20030114193303.623$hA@newsreader.com...
> "Bart Crane" <bcrane@iready.com> wrote:
> > Sorry for not answering your message specifically, but in another
> > response I refer to ANSI X3.4, which excludes 00h..1Fh as
> > control-codes.
>
> Yes, I've read through that. I do not deny that ANSI does declare them as
> control chars.
>
> > The NNTP spec specifically states that Response Data is "textual",
> > and is "usually displayed on the user's terminal."  Thus, ANSI X3.4
> > is relevant, as it defines a standard upon which terminal devices can
> > be made compatible across operating systems.
>
> No that's an jump to a conclusion on your part. I don't see why "textual"
> automatically means this must be ANSI X3.4.

RFC 977 references RFC 822 which references ANSI X3.4.

The conclusion is valid if and only if ANSI-compatibility is
important to the clients being served by the nntp-server.

(If none of the clients were ANSI-compatible, then the
relevant spec would be something else appropriate to those
clients.)

Being ANSI-compatible has some marvelous benefits, one of
which is the ability to write portable text-processing utilities
in C that work on any operating system with an appropriate
runtime library.

This is, of course, exactly my complaint.  That an ANSI-
compatible operating system with an ANSI-compatible C-
compiler is producing different results than the exact same
source code would produce on a Unix computer.


> In the very same RFC which says
> textual, they also defined text - in clear contradiction to ANSI X3.4.
What
> does that mean?

All values defined in each that are not in violation of the other
make up the set of values that are allowed.


>
> Either they overlooked that - a mistake or they understand something other
> in textual than you do.

Also, in 1982 and before, there was not a lot of awareness
with respect to "r" vs. "rb" modes, because C was just breaking
out of the unix-only domain.

This is not a DOS-specific thing.  The International Standards
Organization has blessed the concept and made "text-mode" a
formal part of C.


>
> In any case, RFC 977 defines what they mean with text. They have provided
> EBNF-formulas (extended backus naur') which exactly define what is valid
> for text, headers, etc.

I do not find any such in RFC 977, just references to RFCs 822,
850,  793 and 821.

An important distinction to make is that while 822 and 821 define
the format of "messages", 977 defines a format for the "transport"
of those messages.

RFC 977 defines how these messages are to be transported:
using only the low 7-bits, and excluding control-codes except
as defined.

The 7-bit restriction is being lifted, and while in the process of
doing that, the control-code restriction was also lifted, which is
the source of the incompatibility with non-Unix computers.


>
> > (Again, not a standards expert, I just read specs so as to build
> > systems that work across operating systems and platforms.)
>
> Right, me neither, but that spec defines what text regarding nntp is. You
> trust all your argumentation in those two words "textual matter" which is
> never explained anywhere - and therefor ambigous and problematic.

Yes, it is vague, and my interpretation is what I have stated.

In my mind, the phrase "ANSI-compatibility" sums it all up.
In my mind, it was the only way you could guarantee that data
produced on one computer could be processed on another.

The fopen "r" mode was added to C specifically for this reason.


>
> > > Meaning anything exluding 00h, 0Ah and 0Dh (up to 127dec). Again, this
> > > explicitly *includes* 1Ah. This defines *text* not binary data.
> >
> > Then this protocol is not compatible with operating systems that
> > use ANSI-defined control-codes for text-mode streams, but
> > which would be somewhat problematic for legacy applications
> > that presume a 1-byte character-set!!!
>
> Right. This is a problem for systems that can't cope with it. You
> apparently have one such. Now who was first, the spec or your system/tools
> ?

The ANSI spec was first, my tools were second, new multi-byte
character set protocols third.


>
> > Note that Section 5 has this interesting wording:
> >
> > "5. Security Considerations
> >
> >    Care needs to be taken when displaying messages on a terminal or
> >    terminal emulator.  Powerful terminals may act on escape sequences
> >    and other combinations of ASCII control characters with a variety of
> >    consequences.  They can remap the keyboard or permit other
> >    modifications to the terminal which could lead to denial of service
> >    or even damaged data.  They can trigger (sometimes programmable)
> >    answerback messages which can allow a message to cause commands to be
> >    issued on the recipient's behalf.  They can also effect the operation
> >    of terminal attached devices such as printers.  Message viewers may
> >    wish to strip potentially dangerous terminal escape sequences from
> >    the message prior to display.  "
> >
> > This is my position exactly.  Contrasting the NNTP author's statement
> > that the nntp response data is usually "displayed on the user's
terminal"
> > with that statement above.
>
> Right, and I dont disagree with it either. "Care needs to be taken
when..."
> This care needs to be taken by *your system* or *your tools* not by the
> standard.

In this case, there is nothing I can do about 1Ah.  When the
C runtime library encounters it, it means End Of File, no
matter how much data remains to process.

If I were to install a binary-to-text filter, it would need all
the intelligence of the decoder to know exactly what to
convert the 1Ah to, depending on if the 1Ah appears in
the middle of a YENC-encoded data block, or some other
newly introduced protocol.

Any nntp-server operator could choose to on enforce the spec,
and allow clients to post "terminal bombs".

Or, an nntp-server operator could choose to enforce the spec,
and disallow clients from posting articles that contain "terminal
bombs".


> The standard has no power to control what any system anywhere
> actually does - therefor to remain fully functional, a programmer of any
> tool on such a plattform has to take care that it still works - that's how
> I read this paragraph.

As above, I can not escape 1Ah without knowing the context
of the data in which it appears, and any new encoding format can
be used, which will affect the entire pipeline, not just the article
using the new encoding format.


>
> As has been already pointed out to you earlier in this thread, you could
> include a wrapper which somehow escapes out the 1Ah code and re-injects
> them later, after the critical, non-coping program in your filter chain is
> through with it. That's what I read as "Message viewers may wish to strip
> potentially dangerous terminal escape sequences from the message prior to
> display." from above quote.

Oh, sorry, I described this above.

I could write a stupid filter that just assumes any 1Ah is the
result of being YENC-encoded, and just apply the YENC-
escape.

But, what if it is not YENC-encoded?  Then I would apply
the wrong escape, and the data would be corrupted.

Alternatively, what if I am reading from a device that
actually uses CTRL-Z to mean End Of File?  In which
case, my filter would attempt to continue reading, and
hang.

This is not about DOS being broken.

This is all about the need for "text-" vs. "binary-" streams.

There is a reason for fopen() "r" vs. "rb".

And, some of these protocols were documenting the
existing practice, which, in some cases, were never run on
anything but Unix machines.  Thus, references that say a
text-character is any-character is a hold-over from those
days, because on Unix, "r" == "rb".

On computers where "r" != "rb", you can be sure that not
any-character is a text-character.


>
> NNTP is clearly no message viewer, its a transport system (that's even in
> the name). Your filter chain qualifies as message viewer though.

True.  The nntp-spec does not require nntp-server operators to
ensure that the data it is transporting does not violate any device-
specific restrictions.

On the other hand, it does not deny that, either.  I had asked
the author of YENC to please include 1Ah as a Critical
Character, I had asked a vendor of newsposting software
to voluntarily do this.  When the "cooperative client"
approach failed, I asked about this "server enforcement"
approach.

The fact is that people are sending the equivalent of DOS
text-bombs, and it is disrupting processing of systems based
on published standards.


>
> > > So you see, both RFC 2822 AND 822 explicitly define the char 1Ah as
> > > text. If you or your OS or your tools can't cope with them, they are
in
> > > error.
> >
> > Values between 00h..1Fh may be compatible with one aspect
> > of the spec, but they are invalid with another (ANSI X3.4), and
> > result in a true interoperability problem, which is what I am
> > reporting.
>
> Now I wanted to look up something on that ANSI standard and googling for
> it, I happen to find this one :
> "http://www.itl.nist.gov/fipspubs/33fipwd.htm" This document states that
> the FIPS 1-2 Standard publication has been withdrawn.
>
> Now I'm not quite sure what this means, but it could mean that ANSI X3.4
> has been obsoleted and is of no concern any longer. It says : "These
> thirty-three FIPS are being withdrawn because they are obsolete, or have
> not been updated to adopt current voluntary industry standards. "
>
> So if I understand that right, this means all your argumentation was based
> on too old a fundament.

I fully expect my system to be incompatible with protocols developed
in the new international, multi-byte, character-set paradigm.


>
> > Interpretations that ignore the "user's terminal" aspect or that
> > equate "textual" == "binary" are not in the spirit of what NNTP
> > was designed to accomplish.
>
> But NNTP defines textual. The interpretation of a special char happens in
> your program, not in NNTP.
> Your terminal (console) can without any problem
> show 1Ah, your filter program in your pipe-chain can't. Why? Because it
> makes an interpretation where it should not. Replace it and all will be
> fine.

RFC 977 Section 1 defines why NNTP was proposed, precisely
because (an alternative) was not suitable for use with clients using
different operating systems.

The interpretation that 1Ah is a textual character is not in keeping
with the intent of NNTP, because it results in aborted processing
on one of those different operating systems.

Thanks for your input.

Bart.


>
> --
> -------------------- http://NewsReader.Com/ --------------------
> Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


Technical Details
Message-ID: <0x3V9.89$2r2.79670@news.uswest.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.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!news.infoave.net!newsfeed1.easynews.com!easynews.com!easynews!feed.news.qwest.net!news.uswest.net.POSTED!not-for-mail
References: <BXLR9.432835$pN3.48082@sccrnsc03> <1041772747.319829@ok-corral.gunslinger.net> <BiqS9.160$wz1.152433@news.uswest.net> <1042007522.340079@ok-corral.gunslinger.net> <8d$Rtvs3cDD@3247.org> <aOIU9.101$qk2.63728@news.uswest.net> <QGKU9.41482$No.6059@sccrnsc04> <20030114080852.917$xx@newsreader.com> <r11V9.71$2r2.60729@news.uswest.net> <20030114193303.623$hA@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <0x3V9.89$2r2.79670@news.uswest.net>
Subject: Re: NNTP and YENC
Date: Tue, 14 Jan 2003 18:20:23 -0800
From: "Bart Crane" <bcrane@iready.com>
References: <BXLR9.432835$pN3.48082@sccrnsc03> <1041772747.319829@ok-corral.gunslinger.net> <BiqS9.160$wz1.152433@news.uswest.net> <1042007522.340079@ok-corral.gunslinger.net> <8d$Rtvs3cDD@3247.org> <aOIU9.101$qk2.63728@news.uswest.net> <QGKU9.41482$No.6059@sccrnsc04> <20030114080852.917$xx@newsreader.com> <r11V9.71$2r2.60729@news.uswest.net> <20030114193303.623$hA@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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!news.infoave.net!newsfeed1.easynews.com!easynews.com!easynews!feed.news.qwest.net!news.uswest.net.POSTED!not-for-mail
Newsgroups: news.software.nntp
Lines: 289
Organization: iReady Corp.
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
NNTP-Posting-Host: 65.115.68.98
X-Trace: news.uswest.net 1042597052 65.115.68.98 (Tue, 14 Jan 2003 20:17:32 CST)
NNTP-Posting-Date: Tue, 14 Jan 2003 20:17:32 CST