Thread View: news.software.nntp
14 messages
14 total messages
Started by Julien ÉLIE
Sat, 17 Oct 2009 20:51
Spaces in NNTP commands
Author: Julien ÉLIE
Date: Sat, 17 Oct 2009 20:51
Date: Sat, 17 Oct 2009 20:51
33 lines
2068 bytes
2068 bytes
Hi, Is it OK to just discard empty NNTP commands or commands containing only white spaces? 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? -- Julien ÉLIE « Se taire, c'est pareil dans toutes les langues. » (Philippe Geluck)
Re: Spaces in NNTP commands
Author: D. Stussy
Date: Sun, 18 Oct 2009 07:14
Date: Sun, 18 Oct 2009 07:14
33 lines
2128 bytes
2128 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:hbdap8$7e8$1@news.trigofacile.com... > Is it OK to just discard empty NNTP commands or commands containing > only white spaces? > 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? Have an empty command counter. 5 consecutive empty lines => "500 Too many blank lines."
Re: Spaces in NNTP commands
Author: 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/
Re: Spaces in NNTP commands
Author: Julien ÉLIE
Date: Sun, 18 Oct 2009 16:38
Date: Sun, 18 Oct 2009 16:38
60 lines
3644 bytes
3644 bytes
Hi Curt, > 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. Oh, so you've never used INN? [S] 200 news.ecp.fr InterNetNews server INN 2.4.3 (20050407 prerelease) ready [C] [C] [S] 500 Syntax error or bad command It moans after two empty lines. Fixed in INN 2.5.2. > I use > NNTP servers as command shells interactively and I like my command servers > to not bitch at me just because I hit return. :) That's indeed better! INN also allows commands terminated with "\n" instead of "\r\n" for the same reason . > The one exception I had to deal with for that is allowing spaces in message > ids. And not AUTHINFO USER/PASS? > 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. It is what the protocol says. After TAKETHIS, the news server should wait for "\r\n.\r\n" before answering. A multi-line data block is included after TAKETHIS. So 500/501 errors MUST only be given after that data-block. Or with pipelining, the answer could be sent just after having received TAKETHIS, and all the multi-line data block is then discarded by the news server (it does not answer again after it). Note that, as we once discussed (<20090410161411.260$qR@newsreader.com>), we do not know well whether 501 (syntax error) or 439 (unwanted article) should be returned after a wrong TAKETHIS command... 501 according to RFC 3977, 439 according to the behaviour of current software... Still an issue. To fix an "historic misbehaviour" or not to fix it... -- Julien ÉLIE « Quelle folie, Ô Astérix, que de t'être venu fourrer dans la gueule de la louve romaine. » (Astérix)
Re: Spaces in NNTP commands
Author: Russ Allbery
Date: Sun, 18 Oct 2009 16:54
Date: Sun, 18 Oct 2009 16:54
34 lines
2719 bytes
2719 bytes
curt@kcwc.com (Curt Welch) writes:
> 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. :)
The only drawback that I can see to accepting and ignoring blank lines is
that if a client intended to send a command and for some unknown reason
accidentally sent a blank line, it's likely to then deadlock waiting for a
server response. That can be a lot harder to debug than an error message
complaining about an empty line.
But given that we've ignored empty lines for years, I'm not sure it's
worth changing just for 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.
I think ignoring unambiguous whitespace falls comfortably into the "be
liberal in what you accept" policy in a way that causes no harm. It makes
things much more convenient when sending commands by hand.
(I'm actually on vacation and about to disappear for a while, so any
replies to this message may take some time for a response.)
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Spaces in NNTP commands
Author: floffy
Date: Sun, 18 Oct 2009 20:09
Date: Sun, 18 Oct 2009 20:09
14 lines
1645 bytes
1645 bytes
On 18 Oct 2009 14:32:12 GMT, curt@kcwc.com (Curt Welch) wrote: > >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. What do you use ? for news server
Re: Spaces in NNTP commands
Author: Curt Welch
Date: Sun, 18 Oct 2009 21:38
Date: Sun, 18 Oct 2009 21:38
24 lines
2603 bytes
2603 bytes
"floffy" <gallaxial@hotmail.com> wrote: > On 18 Oct 2009 14:32:12 GMT, curt@kcwc.com (Curt Welch) wrote: > > > > >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. > > What do you use ? > for news server Are you asking what server software to I run my business with? For about 10 years, I used the software I wrote. I used diablo and inn before that. We use diablo and a collection of custom systems now. The software I wrote had an architecture that had performance limits that showed up when the Usenet volume hit a few hundred messages. It was easier to switch to Diablo than re-factor the architecture of my software to solve the performance problem. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com http://NewsReader.Com/
Re: Spaces in NNTP commands
Author: D. Stussy
Date: Sun, 18 Oct 2009 21:55
Date: Sun, 18 Oct 2009 21:55
116 lines
6021 bytes
6021 bytes
"Curt Welch" <curt@kcwc.com> wrote in message news:20091018102618.742$eW@newsreader.com... > =?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. Is a space in a message-ID even a valid character? A space is not part of the character set allowed by "atext" (from the BNF) nor "qtext" (for quoted strings) nor "dtext". Message-ID technically relies only on "atext" and "dtext". Therefore, I conclude that spaces are NOT allowed in message ID's, even inside a quoted string (if such were allowed in a MID). Although the original news message format borrowed much from RFC 822, I have used its current replacement, RFC 5322, for reference. Section 3.6.4 of 5322 contains the BNF syntax for a message-id field. Note also that a message-id is supposed to have a guarentee of uniqueness. Therefore, MIDs like <...@localhost> are INVALID - for violating the uniqueness property (and similarly with any other reserved domain entry). (Yes, there are people that do send messages with the domain-part set to "localhost" or "example.com" and the like. In my cleanfeed.local file, I add these to the filtered out MIDs as such messages are considered malformed and thus SPAM). > 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. If there's a space, it should be rejected with the error appropriate to a bad parameter, not a bad command. > 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. As long as we're dealing with NNTP command parsing, should a PASSWORD or USER-ID be permitted to contain a space? Unlike that with MID, I'm not certain I've seen anything that would intentionally disallow such.
Re: Spaces in NNTP commands
Author: D. Stussy
Date: Sun, 18 Oct 2009 21:55
Date: Sun, 18 Oct 2009 21:55
116 lines
6118 bytes
6118 bytes
"Curt Welch" <curt@kcwc.com> wrote in message news:20091018102618.742$eW@newsreader.com... > =?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. Is a space in a message-ID even a valid character? A space is not part of the character set allowed by "atext" (from the BNF) nor "qtext" (for quoted strings) nor "dtext". Message-ID technically relies only on "atext" and "dtext". Therefore, I conclude that spaces are NOT allowed in message ID's, even inside a quoted string (if such were allowed in a MID). Although the original news message format borrowed much from RFC 822, I have used its current replacement, RFC 5322, for reference. Section 3.6.4 of 5322 contains the BNF syntax for a message-id field. Note also that a message-id is supposed to have a guarentee of uniqueness. Therefore, MIDs like <...@localhost> are INVALID - for violating the uniqueness property (and similarly with any other reserved domain entry). (Yes, there are people that do send messages with the domain-part set to "localhost" or "example.com" and the like. In my cleanfeed.local file, I add these to the filtered out MIDs as such messages are considered malformed and thus SPAM). > 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. If there's a space, it should be rejected with the error appropriate to a bad parameter, not a bad command. > 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. As long as we're dealing with NNTP command parsing, should a PASSWORD or USER-ID be permitted to contain a space? Unlike that with MID, I'm not certain I've seen anything that would intentionally disallow such.
Re: Spaces in NNTP commands
Author: D. Stussy
Date: Sun, 18 Oct 2009 21:55
Date: Sun, 18 Oct 2009 21:55
116 lines
6211 bytes
6211 bytes
"Curt Welch" <curt@kcwc.com> wrote in message news:20091018102618.742$eW@newsreader.com... > =?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. Is a space in a message-ID even a valid character? A space is not part of the character set allowed by "atext" (from the BNF) nor "qtext" (for quoted strings) nor "dtext". Message-ID technically relies only on "atext" and "dtext". Therefore, I conclude that spaces are NOT allowed in message ID's, even inside a quoted string (if such were allowed in a MID). Although the original news message format borrowed much from RFC 822, I have used its current replacement, RFC 5322, for reference. Section 3.6.4 of 5322 contains the BNF syntax for a message-id field. Note also that a message-id is supposed to have a guarentee of uniqueness. Therefore, MIDs like <...@localhost> are INVALID - for violating the uniqueness property (and similarly with any other reserved domain entry). (Yes, there are people that do send messages with the domain-part set to "localhost" or "example.com" and the like. In my cleanfeed.local file, I add these to the filtered out MIDs as such messages are considered malformed and thus SPAM). > 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. If there's a space, it should be rejected with the error appropriate to a bad parameter, not a bad command. > 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. As long as we're dealing with NNTP command parsing, should a PASSWORD or USER-ID be permitted to contain a space? Unlike that with MID, I'm not certain I've seen anything that would intentionally disallow such.
Re: Spaces in NNTP commands
Author: Curt Welch
Date: Sun, 18 Oct 2009 23:30
Date: Sun, 18 Oct 2009 23:30
180 lines
10150 bytes
10150 bytes
"D. Stussy" <replies@newsgroups.kd6lvw.ampr.org> wrote: > "Curt Welch" <curt@kcwc.com> wrote in message > news:20091018102618.742$eW@newsreader.com... > > =?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. > > Is a space in a message-ID even a valid character? Nope, they never have been. But yet, Diablo at one time (15 years ago) would allow them, and would pass them along to other sites, and there were people generating them. If you didn't handle it correctly the feed coming from the diablo server that tried to send it to you, would hang and would stop feeding you new articles). Which meant that if one guy somewhere on Usenet, injected an article that had a Message-ID with a space, all your diablo peers would get it (from their diablo peers) and try to send it to you. If your software didn't receive it, and reject it correctly, all your peers that ran diablo would stop sending you new articles because they would keep trying to send you the bad article over and over again. So one guy, someone on Usenet, injecting a bad message-id article, could shut down a good number of your peers if your software didn't deal correctly with that type of invalid message-id. You didn't have to accept the article, but you did have to correctly receive the entire thing from the peer, and correctly send back a reject message with the correct (aka invalid) message-id on it so the sending diablo would remove it from the queue and not get stuck trying to send it to you over and over. > A space is not part of the character set allowed by "atext" (from the > BNF) nor "qtext" (for quoted strings) nor "dtext". Message-ID > technically relies only on "atext" and "dtext". Therefore, I conclude > that spaces are NOT allowed in message ID's, even inside a quoted string > (if such were allowed in a MID). > > Although the original news message format borrowed much from RFC 822, I > have used its current replacement, RFC 5322, for reference. Section > 3.6.4 of 5322 contains the BNF syntax for a message-id field. > > Note also that a message-id is supposed to have a guarentee of > uniqueness. Therefore, MIDs like <...@localhost> are INVALID - for > violating the uniqueness property (and similarly with any other reserved > domain entry). (Yes, there are people that do send messages with the > domain-part set to "localhost" or "example.com" and the like. In my > cleanfeed.local file, I add these to the filtered out MIDs as such > messages are considered malformed and thus SPAM). It's physically impossible to guarantee uniqueness with 100% accuracy. To do so, would require machines that ran with 100% reliability and software developers that wrote code with 100% guarantee of accuracy - both of which is impossible. In truth, what we have to live with, is to reduce the odds of collision to some acceptable level (which has never been formally defined in an RFC as far as I know). However, "acceptable level" on Usenet, is actually not hard at all. The fact that a message posted to Usenet might get lost, is really not all that important. It happens all the time for lots of different reasons. If we lose a few messages a day out of millions, that's more than good enough for all practical issues. Usenet still works fine even if a loss rate that high. As such, any system for generating message ids simply has to work well enough so that the number of articles lost due to MID collisions is some safe level below the typical rate at which articles are lost on Usenet due to all other reasons. That is, if we are loosing one message because of MID collision, for every 1000 lost for every reason, that extra 1 out of 1000 isn't all that bad. If that acceptable level is chosen to be 1 out of 10^10 (just to pick some small number out of my ass), then you can generate message IDs using a hashing system that reduces the odds of collision to that level. A random hash with approximately twice the number of bits needed to produce 10^10 values will get you in the ball park. Or 2log2(10*10) or about 67 bits of "good" random data. If you can put 6 bits per MID character we are talking about 10 digits of random characters in a message id that ends with @localhost to reduce the odds of collision to a level that is good enough to allow Usenet to work as expected. So, if the rest of the MID is generated correctly, ending in @localhost is not strictly so bad. However, most message-ids ending in @localhost do so because of poorly configured or designed systems which aren't generating the rest of the ID in a way to make up for the error so using that as a strong indicator of a poor quality article (spam) is probably fine. > > 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. > > If there's a space, it should be rejected with the error appropriate to a > bad parameter, not a bad command. > > > 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. > > As long as we're dealing with NNTP command parsing, should a PASSWORD or > USER-ID be permitted to contain a space? Unlike that with MID, I'm not > certain I've seen anything that would intentionally disallow such. Mine don't support it. I don't know if any do. I don't think there's any reason to require NNTP servers to support it - at least not for AUTHINFO commands. If you want to define a new auth system that does support it, that's fine. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com http://NewsReader.Com/
Re: Spaces in NNTP commands
Author: Julien ÉLIE
Date: Tue, 20 Oct 2009 18:32
Date: Tue, 20 Oct 2009 18:32
104 lines
5510 bytes
5510 bytes
Hi D. Stussy,
> Is a space in a message-ID even a valid character?
>
> A space is not part of the character set allowed by "atext" (from the BNF)
> nor "qtext" (for quoted strings) nor "dtext". Message-ID technically
> relies only on "atext" and "dtext". Therefore, I conclude that spaces are
> NOT allowed in message ID's, even inside a quoted string (if such were
> allowed in a MID).
>
> Although the original news message format borrowed much from RFC 822, I
> have used its current replacement, RFC 5322, for reference. Section 3.6.4
> of 5322 contains the BNF syntax for a message-id field.
According to USEFOR (future RFC 5536), with editorial notes by Charles Lindsey:
3.1.3. Message-ID
The Message-ID header field contains a unique message identifier.
Netnews is more dependent on message identifier uniqueness and fast
comparison than Email is, and some news software and standards
[RFC3977] might have trouble with the full range of possible
<msg-id>s permitted by [RFC5322]. This section therefore restricts
the syntax of <msg-id> as compared to Section 3.6.4 of [RFC5322].
The global uniqueness requirement for <msg-id> in [RFC5322] is to be
understood as applying across all protocols using such message
identifiers, and across both Email and Netnews in particular.
message-id = "Message-ID:" SP *WSP msg-id *WSP CRLF
msg-id = "<" msg-id-core ">"
; maximum length is 250 octets
msg-id-core = id-left "@" id-right
id-left = dot-atom-text
id-right = dot-atom-text / no-fold-literal
no-fold-literal = "[" *mdtext "]"
mdtext = %d33-61 / ; The rest of the US-ASCII
%d63-90 / ; characters not including
%d94-126 ; ">", "[", "]", or "\"
{{EDITORIAL NOTE: <mdtext> replaces <dtext> from RFC 5322 (or you could
simply redefine <dtext>); the effect is to remove ">".}}
The msg-id MUST NOT be more than 250 octets in length.
NOTE: The length restriction ensures that systems that accept
message identifiers as a parameter when referencing an article
(e.g. [RFC3977]) can rely on a bounded length.
Observe that msg-id includes the < and >.
Observe also that in contrast to the corresponding header field in
[RFC5322]:
o The syntax does not allow comments within the Message-ID header
field,
o There is no possibility for ">" to occur inside a <msg-id>.
{{EDITORIAL NOTE: I have removed the bullet about <id-rights>s now being
case-sensitive because I cannot see that they ever were so even in RFC
2822, and if they were then we have done nothing to change that.}}
This is to simplify processing by news servers and to ensure
interoperability with existing implementations and compliance with
[RFC3977]. Moreover, a simple comparison of octets will always suffice
to determine the identity of two <msg-id>s.
Also note that this updated ABNF applies wherever <msg-id> is used,
including the References header field discussed in Section 3.2.10 and
the Supersedes header field discussed in Section 3.2.12.
Some current software may try to match the <id-right> of a <msg-id> in
a case-insensitive fashion; some may match it in a case-sensitive
fashion. Implementations MUST NOT generate a Message-ID where the only
difference from another Message-ID is the case of characters in the
<id-right> part.
When generating a <msg-id>, implementations SHOULD use a domain name
as the <id-right>.
NOTE: Section 3.6.4 of [RFC5322] recommends that the <id-right>
should be a domain name or a domain literal. Domain literals are
troublesome since many IP addresses are not globally unique;
domain names are more likely to generate unique Message-IDs.
> As long as we're dealing with NNTP command parsing, should a PASSWORD or
> USER-ID be permitted to contain a space?
SHOULD, not. But MAY, yes :)
--
Julien ÉLIE
« -- Je t'ai préparé une bonne soupe dont tu me diras des nouvelles, mon garçon !
-- Pour moi, ça, ce n'est pas des bonnes nouvelles ! » (Astérix)
Re: Spaces in NNTP commands
Author: Julien ÉLIE
Date: Tue, 20 Oct 2009 18:33
Date: Tue, 20 Oct 2009 18:33
68 lines
4328 bytes
4328 bytes
Hi Curt, >> Is a space in a message-ID even a valid character? > > Nope, they never have been. But yet, Diablo at one time (15 years ago) > would allow them, and would pass them along to other sites, and there were > people generating them. [...] You didn't have to accept the article, > but you did have to correctly receive the entire thing from the peer, and > correctly send back a reject message with the correct (aka invalid) > message-id on it so the sending diablo would remove it from the queue and > not get stuck trying to send it to you over and over. Too bad such a behaviour was implemented. I still see nowadays invalid message-IDs like <4ac9a2d6$0$21410$afc38c87@> (received on October, 5th 2009, 09:46:48) and these are still to be rejected as 43x errors after CHECK/IHAVE/TAKETHIS, and not 501 :-( >> As long as we're dealing with NNTP command parsing, should a PASSWORD or >> USER-ID be permitted to contain a space? Unlike that with MID, I'm not >> certain I've seen anything that would intentionally disallow such. > > Mine don't support it. I don't know if any do. Interesting question. I will ask. INN 2.5.2 will do, thanks to a patch created by Jeff. > I don't think there's any > reason to require NNTP servers to support it - at least not for AUTHINFO > commands. If you want to define a new auth system that does support it, > that's fine. No need to define a new auth system. RFC 4643 says: Note that a server MAY (but is not required to) allow white space characters in usernames and passwords. A server implementation MAY blindly split command arguments at white space and therefore may not preserve the exact sequence of white space characters in the username or password. Therefore, a client SHOULD scan the username and password for white space and, if any is detected, warn the user of the likelihood of problems. The SASL PLAIN [PLAIN] mechanism is recommended as an alternative, as it does not suffer from these issues. [...] NOTE: a server implementation MAY parse AUTHINFO USER and AUTHINFO PASS specially so as to allow white space to be used within the username or password. Such implementations accept the additional syntax (making these two items inconsistent with "token" in Section 9.8 of [NNTP]): user-pass-char =/ SP / TAB In doing so, the grammar can become ambiguous if the username or password begins or ends with white space. To solve this ambiguity, such implementations typically treat everything after the first white space character following "USER"/"PASS", up to, but not including, the CRLF, as the username/password. -- Julien ÉLIE « Cinq millions et demi de conducteurs français ont une mauvaise vue. Heureusement, leur nombre diminue de jour en jour. » (Coluche)
Re: Spaces in NNTP commands
Author: D. Stussy
Date: Wed, 21 Oct 2009 00:18
Date: Wed, 21 Oct 2009 00:18
25 lines
1902 bytes
1902 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:hbkvpj$a33$1@news.trigofacile.com... > >> As long as we're dealing with NNTP command parsing, should a PASSWORD or > >> USER-ID be permitted to contain a space? Unlike that with MID, I'm not > >> certain I've seen anything that would intentionally disallow such. > > > > Mine don't support it. I don't know if any do. > > Interesting question. I will ask. > INN 2.5.2 will do, thanks to a patch created by Jeff. > > ... > > No need to define a new auth system. RFC 4643 says: > > Note that a server MAY (but is not required to) allow white space > characters in usernames and passwords. A server implementation MAY > ... Then let's document this specifically somewhere in INN whether it does or not.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads