Opened 12 years ago

Closed 11 years ago

#99 closed defect (fixed)

Add a decent command parser to innd

Reported by: Julien ÉLIE Owned by: eagle
Priority: medium Milestone: 2.5.2
Component: innd Version: 2.4.5
Severity: normal Keywords: compliance


innd should have a decent command parser. It would then be easier to implement RFC 3977, 4643 and 4644 if an array contained the provided command-line arguments.

It will also fix a few bugs in current parsing (IHAVE<article> without a space is currently a recognized syntax, length of arguments is not checked, etc.).

Change History (5)

comment:1 Changed 12 years ago by Julien ÉLIE

Keywords: compliance added

Keywords and arguments MUST be each separated by one or more US-ASCII SPACE or US-ASCII TAB characters.

Suggested fix: Lift the argument parsing code into a function called from NCproc, breaking the command line into a vector of command and arguments. This will work for all commands implemented by innd and will simplify the implementation of command handlers, as well as fixing this problem. This is what nnrpd already does.

comment:2 Changed 12 years ago by Julien ÉLIE

In innd, if the connection is determined to need authentication, all incoming commands other than MODE are handed off to NCauthinfo() rather than their normal command handlers. NCauthinfo() responds with a 480 reply code to anything other than AUTHINFO USER, AUTHINFO PASS, or QUIT.

Suggested fix: Restructure the command table so that each command also has a flag indicating whether it requires authentication for peers that are required to authenticate. (Some commands, like HELP and MODE READER, should be allowed without authentication.) Then eliminate the special casing of the state CSgetauth (it may be better to store whether the peer has authenticated in the channel rather than in the channel state) and the special handling in NCauthinfo. This should also simplify the code.

comment:3 Changed 11 years ago by Julien ÉLIE


Length checks done in [8663] (NNTP command) and [8667] (argument to a command).

comment:4 Changed 11 years ago by Julien ÉLIE

(In [8672]) * Add a decent parser to innd for NNTP commands. It now puts into
a table the given arguments. It permits to have a far better
grammar parser (commands like "IHAVE<mid>" are no longer valid,
and commands like " IHAVE <mid> " are now valid).

  • The length of each NNTP command is no longer necessary to be kept

in memory by the command handler.

see #99

comment:5 Changed 11 years ago by Julien ÉLIE

Resolution: fixed
Status: newclosed

(In [8675]) * Add a flag to each NNTP command so as to mention whether
it can be used without being authenticated (AUTHINFO, HELP,

  • Eliminate the special casing of the state CSgetauth.

Whether the peer has authenticated is now stored in the
channel rather than in the channel state. It simplifies
a lot the code.

  • Fix a bug in the response for reader commands: innd was

answering with a superfluous blank line when readers were
not allowed.

close #99

Note: See TracTickets for help on using tickets.