INN commit: trunk/innd (nc.c)
INN Commit
rra at isc.org
Sat Oct 24 09:31:02 UTC 2009
Date: Saturday, October 24, 2009 @ 02:31:02
Author: iulius
Revision: 8684
When innd cannot provide information for LIST NEWSGROUPS
and LIST ACTIVE.TIMES, it now returns 503. It was giving
an invalid result (".\r\n" without any response code!).
Modified:
trunk/innd/nc.c
------+
nc.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
Modified: nc.c
===================================================================
--- nc.c 2009-10-24 09:15:11 UTC (rev 8683)
+++ nc.c 2009-10-24 09:31:02 UTC (rev 8684)
@@ -690,23 +690,45 @@
/* ACTIVE when no argument given. */
if (ac == 1 || (strcasecmp(av[1], "ACTIVE") == 0)) {
p = ICDreadactive(&end);
+ /* We always have a valid return from ICDreadactive.
+ * Otherwise, innd is shut down. */
+ xasprintf(&buff, "%d Newsgroups in form \"group high low flags\"",
+ NNTP_OK_LIST);
+ NCwritereply(cp, buff);
+ free(buff);
} else if (strcasecmp(av[1], "NEWSGROUPS") == 0) {
path = concatpath(innconf->pathdb, INN_PATH_NEWSGROUPS);
p = ReadInFile(path, NULL);
free(path);
if (p == NULL) {
- NCwritereply(cp, NCdot);
+ xasprintf(&buff, "%d No list of newsgroup descriptions available",
+ NNTP_ERR_UNAVAILABLE);
+ NCwritereply(cp, buff);
+ free(buff);
return;
- }
+ } else {
+ xasprintf(&buff, "%d Descriptions in form \"group description\"",
+ NNTP_OK_LIST);
+ NCwritereply(cp, buff);
+ free(buff);
+ }
end = p + strlen(p);
} else if (strcasecmp(av[1], "ACTIVE.TIMES") == 0) {
path = concatpath(innconf->pathdb, INN_PATH_ACTIVETIMES);
p = ReadInFile(path, NULL);
free(path);
if (p == NULL) {
- NCwritereply(cp, NCdot);
+ xasprintf(&buff, "%d No list of creation times available",
+ NNTP_ERR_UNAVAILABLE);
+ NCwritereply(cp, buff);
+ free(buff);
return;
- }
+ } else {
+ xasprintf(&buff, "%d Group creations in form \"name time who\"",
+ NNTP_OK_LIST);
+ NCwritereply(cp, buff);
+ free(buff);
+ }
end = p + strlen(p);
} else {
xasprintf(&buff, "%d Unknown LIST keyword", NNTP_ERR_SYNTAX);
@@ -716,8 +738,6 @@
}
/* Loop over all lines, sending the text and "\r\n". */
- WCHANappend(cp, NNTP_LIST_FOLLOWS, strlen(NNTP_LIST_FOLLOWS));
- WCHANappend(cp, NCterm, strlen(NCterm)) ;
for (; p < end && (q = strchr(p, '\n')) != NULL; p = q + 1) {
WCHANappend(cp, p, q - p);
WCHANappend(cp, NCterm, strlen(NCterm));
More information about the inn-committers
mailing list