Bugs in nnrpd
Heiko Schlichting
inn-bugs at FU-Berlin.DE
Tue Feb 1 02:39:22 UTC 2000
INN-Current, Snaphot inn-2000-01-31_03-02:
I found some bugs in nnrpd - two of them are serious. I created a patch
which is attached to this mail. It should fix two major problems and a
few minor things.
[MINOR] Issueing an XHDR command with a range before entering a group
crashes nnrpd (or does something undefined). nnrpd should reply
with "412 Not in a newsgroup". Fixed in article.c
[MAJOR] nnrpd crashes if OVERGetHeader() returns with NULL while
processing an XHDR command. nnrpd should skip this article
and continue with the next. Fixed in article.c
[MINOR] NEWGROUPS command prints only 2-digit year in usage message. It
should show that a four digit year is also possible. Fixed in
commands.c and nnrpd.c
[MINOR] NEWGROUPS can't handle "UTC" as required in
draft-ietf-nntpext-base-09.txt. "UTC" should be handled as a synonym
for "GMT". Fixed in commands.c
[MINOR] Position of the colon in 'bad distribution list' message is wrong.
Fixed in commands.c
[MAJOR] nnrpd crashes when the NEWGROUPS command tries to print more than
1000 newsgroups. There are 1000 GROUPDATA records allocated but
1001 were used. Fixed in commands.c
[MINOR] NEWNEWS command prints only 2-digit year in usage message. It
should show that a four digit year is also allowed. Fixed in
nnrpd.c
[MINOR] NEWNEWS doesn't handle "UTC" as a synonym to "GMT". It is crazy that
draft-ietf-nntpext-base-09.txt defines "UTC" and "GMT" for the
NEWGROUPS command but for NEWNEWS only "GMT" is mentioned. Looks like
a glitch in the draft - nnrpd should handle both as a synonym. Fixed
in newnews.c
Patch is against the snapshot of yesterday - guess yourself how long it is
tested...
Some or all problems are expected to exist also in the STABLE release.
Heiko
Heiko Schlichting | Freie Universität Berlin
heiko at FU-Berlin.DE | Zentraleinrichtung für Datenverarbeitung (ZEDAT)
Telefon +49 30 838-54327 | Fabeckstraße 32
Telefax +49 30 838-56721 | 14195 Berlin
-- Attached file included as plaintext by Listar --
-- Desc: nnrpd-patch
--- nnrpd/article.c.org Mon Jan 31 12:01:11 2000
+++ nnrpd/article.c Tue Feb 1 02:01:53 2000
@@ -788,6 +788,11 @@
Printf(".\r\n");
return;
}
+
+ if (GRPcount == 0) {
+ Reply("%s\r\n", ARTnotingroup);
+ return;
+ }
/* Range specified. */
if (!CMDgetrange(ac - 1, av + 1, &range, &DidReply)) {
@@ -835,6 +840,8 @@
if (len == 0 || PERMaccessconf->nnrpdcheckart && !ARTinstorebytoken(token))
continue;
p = OVERGetHeader(data, Overview);
+ if (!p)
+ continue;
sprintf(buff, "%lu ", artnum);
SendIOb(buff, strlen(buff));
SendIOb(p, strlen(p));
--- nnrpd/commands.c.org Mon Jan 31 12:01:12 2000
+++ nnrpd/commands.c Tue Feb 1 02:06:47 2000
@@ -575,7 +575,7 @@
FUNCTYPE CMDnewgroups(int ac, char *av[])
{
static char USAGE[] =
- "NEWGROUPS yymmdd hhmmss [\"GMT\"] [<distributions>]";
+ "NEWGROUPS [yy]yymmdd hhmmss [\"GMT\"|\"UTC\"] [<distributions>]";
static char **distlist;
char *p;
char *q;
@@ -601,7 +601,7 @@
}
ac -= 3;
av += 3;
- if (ac > 0 && caseEQ(*av, "GMT")) {
+ if (ac > 0 && (caseEQ(*av, "GMT")|| caseEQ(*av, "UTC"))) {
av++;
ac--;
}
@@ -612,7 +612,7 @@
All = TRUE;
else {
if (!ParseDistlist(&distlist, *av)) {
- Reply("%d Bad distribution list %s:\r\n", NNTP_SYNTAX_VAL, *av);
+ Reply("%d Bad distribution list: %s\r\n", NNTP_SYNTAX_VAL, *av);
return;
}
All = FALSE;
@@ -656,7 +656,7 @@
grouplist = NEW(GROUPDATA, 1000);
listsize = 1000;
}
- if (listsize < numgroups) {
+ if (listsize <= numgroups) {
listsize += 1000;
grouplist = RENEW(grouplist, GROUPDATA, listsize);
}
--- nnrpd/nnrpd.c.org Mon Jan 31 12:01:12 2000
+++ nnrpd/nnrpd.c Tue Feb 1 02:09:35 2000
@@ -123,9 +123,9 @@
{ "mode", CMDmode, FALSE, 2, 2,
"reader" },
{ "newgroups", CMDnewgroups, TRUE, 3, 5,
- "yymmdd hhmmss [\"GMT\"] [<distributions>]" },
+ "[YY]yymmdd hhmmss [\"GMT\"|\"UTC\"] [<distributions>]" },
{ "newnews", CMDnewnews, TRUE, 4, 6,
- "newsgroups yymmdd hhmmss [\"GMT\"] [<distributions>]" },
+ "newsgroups [YY]yymmdd hhmmss [\"GMT\"|\"UTC\"] [<distributions>]" },
{ "next", CMDnextlast, TRUE, 1, 1,
NULL },
{ "post", CMDpost, TRUE, 1, 1,
--- nnrpd/newnews.c.org Mon Jan 31 12:01:12 2000
+++ nnrpd/newnews.c Tue Feb 1 02:14:41 2000
@@ -185,7 +185,7 @@
}
/*
-** NEWNEWS newsgroups date time ["GMT"] [<distributions>]
+** NEWNEWS newsgroups date time ["GMT"|"UTC"] [<distributions>]
** Return the Message-ID of any articles after the specified date,
** and within the specified distributions.
*/
@@ -226,7 +226,7 @@
nice(innconf->nicenewnews);
(void)sprintf(line, "%s %s %s %s %s", av[1], av[2], av[3],
- (ac >= 5 && *av[4] == 'G') ? "GMT" : "local",
+ (ac >= 5 && (*av[4] == 'G' || *av[4] == 'U')) ? "GMT" : "local",
(ac >= 5 && *av[ac - 1] == '<') ? av[ac - 1] : "none");
syslog(L_NOTICE, "%s newnews %s", ClientHost, line);
@@ -252,7 +252,7 @@
}
ac -= 4;
av += 4;
- if (ac > 0 && caseEQ(*av, "GMT")) {
+ if (ac > 0 && (caseEQ(*av, "GMT") || caseEQ(*av, "UTC"))) {
ac--;
av++;
} else
More information about the inn-bugs
mailing list