Subject: [NNTP] Re: Issue with IHAVE in RFC

From: "Clive D.W. Feather" <[email-masked]>
Date: Sat, 18 Apr 2009 10:08:54 +0100

Julien LIE said:
> I believe there is a major issue with the handling of the 501 answer code.
> 
> According to RFC 3977, the following schema is correct:
> 
>  [S] IHAVE <a b c
>  [C] 501 Bad Message-ID

Correct.

> However, it breaks at least INN and Diablo:  upon receiving 501, their
> feeder will block, disconnect, reconnect and send again the same IHAVE...

Then they are wrong.

> Thus, implementing RFC 3977 breaks current implementations.

I disagree. If you look at RFC 977, section 2.4.3, you will see the same
rule: a syntax error in *any* command results in a 501.

> Of course, the same goes if I send a message-ID whose length is 251
> (which could more likely occur than "<a b c").

Correct.

> As for IHAVE, the only possible answer here is 435; on no account
> should 501 be sent.

I disagree. 435 means "not wanted", not "invalid syntax".

> It appears that a few commands require that no check is done on their
> syntax, and it is not mentioned in RFC 3977.

Nor is it mentioned in RFC 977, nor was it *EVER* mentioned in many years
of discussion leading up to 3977.

> A discussion on news.software.nntp led to the fact that 501 is
> not a valid answer.  See for instance 
> <[email-masked]>.

I will look at that.

> Do you have an idea of what it is possible to do as for that issue?

Not easily. You need to decide if you want to work with broken software.

-- 
Clive D.W. Feather          | If you lie to the compiler,
Email: [email-masked]     | it will get its revenge.
Web: http://www.davros.org  |   - Henry Spencer
Mobile: +44 7973 377646

---

From: Julien ÉLIE <[email-masked]>
Date: Sat, 18 Apr 2009 12:30:50 +0200

Hi Clive,

> rule: a syntax error in *any* command results in a 501.

Sure, but RFC 977 defines no syntax for the arguments.  It is difficult
to do something accurate with that.
It even does not state whether quoted message-IDs like <"a b c"@domain>
are valid or not (RFC 977 predates RFC 1036, and such quoted message-IDs
are defined in RFC 822).

RFC 3977 explicitly excludes spaces, which was not the case before.

Note that RFC 977 defines commands in 2.3 as a command word followed
by one or more parameters.  And responses in 2.4.2 as a status code
followed by one or more parameters which cannot contain spaces!

I now understand why DNEWS answers only with the first parameter:

CHECK a b
438 a article not wanted - Missing opening angle bracket

> I disagree. 435 means "not wanted", not "invalid syntax".

Not if RFC 977, in the absence of ABNF syntax, does not treat the
argument for IHAVE as a byte string.
Then, the article is "not wanted" and the syntax is valid.

Do not forget that RFC 4643 makes AUTHINFO USER/PASS inconsistent
with RFC 3977 as for the possibility to use spaces.  And the
argument is a byte string.

This way, and as far as I can see with what news servers answer,
it appears that IHAVE/CHECK/TAKETHIS work as though they are
expecting a byte string, and *not* a message-ID.

INN 1 (yes, version 1):
-----------------------

200 feed-A.news.volia.net InterNetNews server INN 1.7.2 (FAST switching patch) ready
IHAVE test
435 test Bad Message-ID

DIABLO:
-------

200 news1.greatnowhere.com NNTP Service Ready (DIABLO 5.0-REL)
IHAVE test
435 test Bad Message-ID

DNEWS:
------

200 mendel.ac-versailles.fr DNEWS Version  5.7e1,, S0, posting OK
IHAVE test
435 article not wanted - Missing opening angle bracket
CHECK test
438 test article not wanted - Missing opening angle bracket

> of discussion leading up to 3977.

Maybe but discussions do not change what has always been implemented
in news servers.

Incidentally, RFC 4644 clearly explains pipelining with for instance:

      [C] CHECK <[email-masked]>
      [C] CHECK <[email-masked]>
      [C] CHECK <[email-masked]>
      [S] 238 <[email-masked]>
      [S] 438 <[email-masked]>
      [S] 431 <[email-masked]>

but it is nowhere said something like:

      [C] CHECK <[email-masked]>
      [C] CHECK i am a nasty article
      [C] CHECK <[email-masked]>
      [S] 238 <[email-masked]>
      [S] 501 Invalid syntax
      [S] 431 <[email-masked]>

It is not discussed whether news servers should expect, when using
streaming, the unwanted message-ID (as a byte string) just after 501
or other response codes.
The article might get stuck forever in the queue...  Some implementations
(like INN and Diablo) assume they still haven't got the answer to the
CHECK command for "i am a nasty article".

News servers *do* expect a 438 answer (or 439 for TAKETHIS and
435 for IHAVE) when the article is "not wanted".

> Not easily. You need to decide if you want to work with broken software.

(Almost) every news server is then currently broken.
How can we work with them? :)

-- 
Julien ÉLIE

« Quand on sait que le pied vaut environ 33 cm et que l'alexandrin
  compte 12 pieds, il est facile de calculer qu'un stade vaut
  environ 42 alexandrins. » (Astérix)