INN commit: trunk/nnrpd (commands.c nnrpd.c)

INN Commit Russ_Allbery at isc.org
Sat Aug 23 19:23:24 UTC 2008


    Date: Saturday, August 23, 2008 @ 12:23:24
  Author: iulius
Revision: 7956

Commands like "MODE", "MODE FOO" and "MODE FOO BAR" must return
a 500 error code and not a 501 one.  It is now fixed.

Modified:
  trunk/nnrpd/commands.c
  trunk/nnrpd/nnrpd.c

------------+
 commands.c |    2 +-
 nnrpd.c    |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

Modified: commands.c
===================================================================
--- commands.c	2008-08-23 17:35:35 UTC (rev 7955)
+++ commands.c	2008-08-23 19:23:24 UTC (rev 7956)
@@ -309,7 +309,7 @@
                PERMaccessconf->pathhost, INN_VERSION_STRING,
 	       PERMcanpost ? "posting ok" : "no posting");
     else
-	Reply("%d What?\r\n", NNTP_ERR_SYNTAX);
+	Reply("%d What?\r\n", NNTP_ERR_COMMAND);
 }
 
 static int GroupCompare(const void *a1, const void* b1) {

Modified: nnrpd.c
===================================================================
--- nnrpd.c	2008-08-23 17:35:35 UTC (rev 7955)
+++ nnrpd.c	2008-08-23 19:23:24 UTC (rev 7956)
@@ -1134,7 +1134,14 @@
 	for (cp = CMDtable; cp->Name; cp++)
 	    if (strcasecmp(cp->Name, av[0]) == 0)
 		break;
-	if (cp->Name == NULL) {
+
+        /* If no command is recognized or if "mode" is received.
+         * We have to handle the special "mode" command here owing to its not being
+         * a base name:  "mode reader" is the only one currently recognized.
+         * "mode something extra-arg" must not be matched further. */
+	if ( (cp->Name == NULL)
+          || ( (strcasecmp(av[0], "mode") == 0)
+            && ((ac < 2) || (strcasecmp(av[1], "reader") != 0)) ) ) {
 	    if ((int)strlen(buff) > 40)
 		syslog(L_NOTICE, "%s unrecognized %.40s...", Client.host, buff);
 	    else



More information about the inn-committers mailing list