INN commit: trunk (4 files)

INN Commit Russ_Allbery at isc.org
Sat Aug 23 12:41:18 UTC 2008


    Date: Saturday, August 23, 2008 @ 05:41:18
  Author: iulius
Revision: 7952

* Do not display SLAVE in the result of nnrpd's HELP command.
* innd now recognizes DATE, LISTGROUP, STARTTLS, XGTITLE,
  XHDR, XOVER and XPAT as reader commands.
* Remove NNTP_OK_EXTENSIONS (202) which is not RFC-compliant.
* LIST EXTENSIONS now returns 215 and not 202.
* Add NNTP_FAIL_WRONG_MODE (401) but nothing uses it (yet).

Modified:
  trunk/include/inn/nntp.h
  trunk/innd/nc.c
  trunk/nnrpd/list.c
  trunk/nnrpd/nnrpd.c

--------------------+
 include/inn/nntp.h |    2 +-
 innd/nc.c          |   18 +++++++++++++-----
 nnrpd/list.c       |    2 +-
 nnrpd/nnrpd.c      |   19 +++++++++----------
 4 files changed, 24 insertions(+), 17 deletions(-)

Modified: include/inn/nntp.h
===================================================================
--- include/inn/nntp.h	2008-08-05 19:41:17 UTC (rev 7951)
+++ include/inn/nntp.h	2008-08-23 12:41:18 UTC (rev 7952)
@@ -49,7 +49,6 @@
     NNTP_INFO_DATE              = 111,
     NNTP_OK_BANNER_POST         = 200,
     NNTP_OK_BANNER_NOPOST       = 201,
-    NNTP_OK_EXTENSIONS          = 202,
     NNTP_OK_QUIT                = 205,
     NNTP_OK_GROUP               = 211,
     NNTP_OK_LIST                = 215,
@@ -65,6 +64,7 @@
     NNTP_CONT_IHAVE             = 335,
     NNTP_CONT_POST              = 340,
     NNTP_FAIL_TERMINATING       = 400,
+    NNTP_FAIL_WRONG_MODE        = 401, /* Wrong mode (e.g. not reader) */
     NNTP_FAIL_BAD_GROUP         = 411, /* Group unknown */
     NNTP_FAIL_NO_GROUP          = 412, /* Not in a newsgroup */
     NNTP_FAIL_NO_ARTICLE        = 420, /* No current article */

Modified: innd/nc.c
===================================================================
--- innd/nc.c	2008-08-05 19:41:17 UTC (rev 7951)
+++ innd/nc.c	2008-08-23 12:41:18 UTC (rev 7952)
@@ -66,15 +66,23 @@
        READER command. */
     COMMAND("article",   NC_reader),
     COMMAND("body",      NC_reader),
+    COMMAND("date",      NC_reader),
     COMMAND("group",     NC_reader),
     COMMAND("last",      NC_reader),
+    COMMAND("listgroup", NC_reader),
     COMMAND("newgroups", NC_reader),
     COMMAND("newnews",   NC_reader),
     COMMAND("next",      NC_reader),
     COMMAND("post",      NC_reader),
+    COMMAND("starttls",  NC_reader),
+    COMMAND("xgtitle",   NC_reader),
+    COMMAND("xhdr",      NC_reader),
+    COMMAND("xover",     NC_reader),
+    COMMAND("xpat",      NC_reader),
 
-    /* Other unimplemented standard commands. */
-    COMMAND("date",      NC_unimp),
+    /* Other unimplemented standard commands.
+       SLAVE (which was ill-defined in RFC 977) was removed from the NNTP
+       protocol in RFC 3977. */
     COMMAND("slave",     NC_unimp)
 };
 #undef COMMAND
@@ -89,7 +97,7 @@
 static const char       NCbadsubcommand[] = NNTP_BAD_SUBCMD;
 
 /*
-** Clear the WIP entry for the given channel
+** Clear the WIP entry for the given channel.
 */
 void
 NCclearwip(CHANNEL *cp)
@@ -696,7 +704,7 @@
 
 
 /*
-**  The catch-all for inimplemented commands.
+**  The catch-all for unimplemented commands.
 */
 static void
 NC_unimp(CHANNEL *cp)
@@ -709,7 +717,7 @@
 	continue;
     cp->Start = cp->Next;
     *p = '\0';
-    snprintf(buff, sizeof(buff), "%d \"%s\" not implemented; try \"help\".",
+    snprintf(buff, sizeof(buff), "%d \"%s\" not implemented; try \"help\"",
              NNTP_ERR_COMMAND, MaxLength(q, q));
     NCwritereply(cp, buff);
 }

Modified: nnrpd/list.c
===================================================================
--- nnrpd/list.c	2008-08-05 19:41:17 UTC (rev 7951)
+++ nnrpd/list.c	2008-08-23 12:41:18 UTC (rev 7952)
@@ -111,7 +111,7 @@
 {
     const char *mechlist = NULL;
 
-    Reply("%d %s.\r\n", NNTP_OK_EXTENSIONS, lp->Format);
+    Reply("%d %s.\r\n", NNTP_OK_LIST, lp->Format);
 
 #ifdef HAVE_SSL
     if (!nnrpd_starttls_done && PERMauthorized != true)

Modified: nnrpd/nnrpd.c
===================================================================
--- nnrpd/nnrpd.c	2008-08-05 19:41:17 UTC (rev 7951)
+++ nnrpd/nnrpd.c	2008-08-23 12:41:18 UTC (rev 7952)
@@ -141,6 +141,8 @@
 	NULL },
     {	"post",		CMDpost,	true,	1,	1,
 	NULL },
+    /* SLAVE (which was ill-defined in RFC 977) was removed from the NNTP
+       protocol in RFC 3977. */
     {	"slave",	CMD_unimp,	false,	1,	1,
 	NULL },
     {	"stat",		CMDfetch,	true,	1,	2,
@@ -269,11 +271,14 @@
     static const char *newsmaster = NEWSMASTER;
 
     Reply("%s\r\n", NNTP_HELP_FOLLOWS);
-    for (cp = CMDtable; cp->Name; cp++)
+    for (cp = CMDtable; cp->Name; cp++) {
+        if (cp->Function == CMD_unimp)
+            continue;
 	if (cp->Help == NULL)
 	    Printf("  %s\r\n", cp->Name);
 	else
 	    Printf("  %s %s\r\n", cp->Name, cp->Help);
+    }
     if (PERMaccessconf && (VirtualPathlen > 0)) {
 	if (PERMaccessconf->newsmaster) {
 	    if (strchr(PERMaccessconf->newsmaster, '@') == NULL) {
@@ -311,16 +316,10 @@
 **  Unimplemented catch-all.
 */
 void
-CMD_unimp(ac, av)
-    int		ac UNUSED;
-    char	*av[];
+CMD_unimp(int ac UNUSED, char *av[])
 {
-    if (strcasecmp(av[0], "slave") == 0)
-	/* Somebody sends us this?  I don't believe it! */
-	Reply("%d Unsupported\r\n", NNTP_OK_EXTENSIONS);
-    else
-	Reply("%d %s not implemented; try help\r\n",
-	    NNTP_ERR_COMMAND, av[0]);
+    Reply("%d \"%s\" not implemented; try \"help\"\r\n",
+        NNTP_ERR_COMMAND, av[0]);
 }
 
 



More information about the inn-committers mailing list