INN commit: trunk/innd (nc.c)

INN Commit rra at isc.org
Fri Oct 23 17:53:56 UTC 2009


    Date: Friday, October 23, 2009 @ 10:53:56
  Author: iulius
Revision: 8678

Return 412 (no group selected) instead of 501 (syntax error)
when using HEAD/STAT with an article number.

Modified:
  trunk/innd/nc.c

------+
 nc.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Modified: nc.c
===================================================================
--- nc.c	2009-10-21 20:41:41 UTC (rev 8677)
+++ nc.c	2009-10-23 17:53:56 UTC (rev 8678)
@@ -311,8 +311,8 @@
 
     cp->Start = cp->Next;
 
-    /* No argument given. */
-    if (ac == 1) {
+    /* No argument given, or an article number. */
+    if (ac == 1 || IsValidArticleNumber(av[1])) {
         xasprintf(&buff, "%d Not in a newsgroup", NNTP_FAIL_NO_GROUP);
         NCwritereply(cp, buff);
         free(buff);
@@ -338,7 +338,8 @@
         return;
     }
 
-    /* Get the article token and retrieve it. */
+    /* Get the article token and retrieve it (to make sure
+     * the article is still here). */
     if (!HISlookup(History, av[1], NULL, NULL, NULL, &token)) {
         xasprintf(&buff, "%d No such article", NNTP_FAIL_NOTFOUND);
         NCwritereply(cp, buff);
@@ -353,7 +354,7 @@
     }
 
     /* Write it. */
-    xasprintf(&buff, "%d 0 %s%s", NNTP_OK_HEAD, av[1], NCterm);
+    xasprintf(&buff, "%d 0 %s head%s", NNTP_OK_HEAD, av[1], NCterm);
     WCHANappend(cp, buff, strlen(buff));
     WCHANappend(cp, art->data, art->len);
 
@@ -376,8 +377,8 @@
 
     cp->Start = cp->Next;
 
-    /* No argument given. */
-    if (ac == 1) {
+    /* No argument given, or an article number. */
+    if (ac == 1 || IsValidArticleNumber(av[1])) {
         xasprintf(&buff, "%d Not in a newsgroup", NNTP_FAIL_NO_GROUP);
         NCwritereply(cp, buff);
         free(buff);
@@ -403,7 +404,7 @@
         return;
     }
 
-    /* Get the article filenames; open the first file (to make sure
+    /* Get the article token and retrieve it (to make sure
      * the article is still here). */
     if (!HISlookup(History, av[1], NULL, NULL, NULL, &token)) {
         xasprintf(&buff, "%d No such article", NNTP_FAIL_NOTFOUND);
@@ -420,7 +421,7 @@
     SMfreearticle(art);
 
     /* Write the message. */
-    xasprintf(&buff, "%d 0 %s", NNTP_OK_STAT, av[1]);
+    xasprintf(&buff, "%d 0 %s status", NNTP_OK_STAT, av[1]);
     NCwritereply(cp, buff);
     free(buff);
 }




More information about the inn-committers mailing list