INN commit: branches/2.5/innd (nc.c)

INN Commit rra at isc.org
Sun Nov 15 09:22:07 UTC 2009


    Date: Sunday, November 15, 2009 @ 01:22:07
  Author: iulius
Revision: 8768

When the argument to CHECK is not valid, make sure we properly
answer 438 with the whole given argument.

Modified:
  branches/2.5/innd/nc.c

------+
 nc.c |   30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

Modified: nc.c
===================================================================
--- nc.c	2009-11-15 09:21:52 UTC (rev 8767)
+++ nc.c	2009-11-15 09:22:07 UTC (rev 8768)
@@ -1001,7 +1001,9 @@
   char	        *p, *q;
   NCDISPATCH   	*dp;
   struct buffer	*bp;
-  char		buff[SMBUF];
+  char		buff[NNTP_MAXLEN_COMMAND];  /* For our (long) answers for CHECK/TAKETHIS,
+                                             * we need at least the length of the command
+                                             * (512 bytes). */
   size_t	i, j;
   bool		readmore, movedata;
   ARTDATA	*data = &cp->Data;
@@ -1153,8 +1155,13 @@
               }
           }
         }
-        snprintf(buff, sizeof(buff), "%d Line too long",
-                 validcommandtoolong ? syntaxerrorcode : NNTP_ERR_COMMAND);
+        if (syntaxerrorcode == NNTP_FAIL_CHECK_REFUSE) {
+            snprintf(buff, sizeof(buff), "%d %s", syntaxerrorcode,
+                     ac > 1 ? av[1] : "");
+        } else {
+            snprintf(buff, sizeof(buff), "%d Line too long",
+                     validcommandtoolong ? syntaxerrorcode : NNTP_ERR_COMMAND);
+        }
         NCwritereply(cp, buff);
         cp->Start = cp->Next;
 
@@ -1231,8 +1238,13 @@
           for (v = av; *v; v++)
               if (strlen(*v) > NNTP_MAXLEN_ARG) {
                   validcommandtoolong = true;
-                  snprintf(buff, sizeof(buff), "%d Argument too long",
-                           syntaxerrorcode);
+                  if (syntaxerrorcode == NNTP_FAIL_CHECK_REFUSE) {
+                      snprintf(buff, sizeof(buff), "%d %s", syntaxerrorcode,
+                               ac > 1 ? av[1] : "");
+                  } else {
+                      snprintf(buff, sizeof(buff), "%d Argument too long",
+                               syntaxerrorcode);
+                  }
                   NCwritereply(cp, buff);
                   break;
               }
@@ -1245,8 +1257,12 @@
       /* Check usage. */
       if ((dp->Minac != NC_any && ac < dp->Minac)
           || (dp->Maxac != NC_any && ac > dp->Maxac)) {
-          snprintf(buff, sizeof(buff), "%d Syntax is:  %s %s",
-                   syntaxerrorcode, dp->Name, dp->Help ? dp->Help : "(no argument allowed)");
+          if (syntaxerrorcode == NNTP_FAIL_CHECK_REFUSE) {
+              snprintf(buff, sizeof(buff), "%d %s", syntaxerrorcode, ac > 1 ? av[1] : "");
+          } else {
+              snprintf(buff, sizeof(buff), "%d Syntax is:  %s %s",
+                       syntaxerrorcode, dp->Name, dp->Help ? dp->Help : "(no argument allowed)");
+          }
           NCwritereply(cp, buff);
           cp->Start = cp->Next;
           break;




More information about the inn-committers mailing list