Article View: news.software.nntp
Article #82017Re: Spaces in NNTP commands
From: Curt Welch
Date: Sun, 18 Oct 2009 14:32
Date: Sun, 18 Oct 2009 14:32
72 lines
4732 bytes
4732 bytes
=?iso-8859-15?Q?Julien_=C9LIE?= <iulius@nom-de-mon-site.com.invalid> wrote: > Hi, > > Is it OK to just discard empty NNTP commands or commands containing > only white spaces? I have no clue what the specs they have written on this recently say, but all NNTP servers I've used, or written, always ignored empty lines. I use NNTP servers as command shells interactively and I like my command servers to not bitch at me just because I hit return. :) My server had about 20 private NNTP commands for server admin and monitoring so the way I controlled my servers were to telnet to them and type commands. I didn't use a separate out of band protocol to admin my servers like inn and diablo does. And since I did spend a lot of time typing commands by hand to the servers, I wanted them to act like a normal command shell - which ignores blank lines. Real NNTP clines don't send > That is to say answering nothing to "\r\n" and " \r\n", just waiting > for the following real command. > > It is what nnrpd currently does for empty commands (but not innd, which > accepts the first "\r\n" and rejects the second "\r\n" with 500). > > An amusing thing is to write " \r\n" to nnrpd: it closes the connection > :) > > if (ac == 0) > break; > => leave the infinite read loop > (it should be a "continue") > > N.B.: Even though RFC 3977 does not accept " POST" (leading space), > "POST " (trailing space), "IHAVE <mid>" (with two white spaces), > it seems better to accept such commands, as nnrpd currently does. > > And just silently read empty commands. > > Any thought about that? Again, all the NNTP servers I've used or written, act like a command shell and allow extra spaces everywhere, including in front of the commands or after the last argument. Command parsing works by breaking the line into an argc/argv like structure based on spaces so it simply allows spaces everywhere around the words that make up the command. The one exception I had to deal with for that is allowing spaces in message ids. I would reject the message as invalid if it had a space in the MID but I had to hack the parser to special case commands that took message-ids as arguments and parse them correctly if it had a space in it. That was back in the day where Diablo actually allowed message-ids like that and because of that, I was at times, receiving messages from peers that had a space in the message-id. This was required for "TAKETHIS <bad id>". If you rejected it as an invalid command, you break the protocol when the sending site follows that with a full article. You want to correctly take the article from the peer and then correctly reject it. If you don't do that, the peer just gets hung as it keeps trying to send the article to you again without understanding why it's getting 500 errors from your server - which means your feed from that peer might just hang until someone on the sending side manually takes the bad article out of the queue. I would hope current Diablo (and no other current NNTP servers) do that anymore. But it's one more bit of old code that was needed once, and could be useful in the future when someone writes a cheap ass server that allows spaces in Message-ids and tries to feed such articles to a peer. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com http://NewsReader.Com/
Technical Details
Message-ID:
<20091018102618.742$eW@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.20141118.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!novia!transit3.readnews.com!news-xxxfer.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews3.readnews.com!nr5-q1.newsreader.com.POSTED!not-for-mailReferences:
<hbdap8$7e8$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <20091018102618.742$eW@newsreader.com>
Subject: Re: Spaces in NNTP commands
Date: Sun, 18 Oct 2009 14:32:12 +0000
From: curt@kcwc.com (Curt Welch)
References: <hbdap8$7e8$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.20141118.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!novia!transit3.readnews.com!news-xxxfer.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews3.readnews.com!nr5-q1.newsreader.com.POSTED!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-NRC-Trace: NewsReader.Com xRGTwDpX9c6xFYtl5z@FEvUWBPQKzzjK/9Fa25DCbU,Yse2sV
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
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 72
NNTP-Posting-Host: 55286201.nr5-q1.newsreader.com
X-Trace: DXC=\g6aEBk>gg; ; jXfFQH7Z52bgZaH`e<A[9Z?:i9<JJBS>GW>Qj[dSIO2iJ;
iV2YAoG5=fV5A@3IlH8hAfB]0UVI@0
X-Complaints-To: abuse@newsreader.com