INN commit: trunk/innd (art.c nc.c)

INN Commit Russ_Allbery at isc.org
Fri Apr 3 21:49:55 UTC 2009


    Date: Friday, April 3, 2009 @ 14:49:55
  Author: iulius
Revision: 8400

Remember the message-IDs of rejected articles when the reject
is done before ARTpost().

Also remember them when INN is rund in slave mode.

We now properly parse all the headers (and for instance
find out the message-ID or the path of an article even though
the relevant headers come after an error has been triggered off).

Modified:
  trunk/innd/art.c
  trunk/innd/nc.c

-------+
 art.c |   17 +++++++++++------
 nc.c  |   11 +++++++++++
 2 files changed, 22 insertions(+), 6 deletions(-)

Modified: art.c
===================================================================
--- art.c	2009-04-03 19:35:29 UTC (rev 8399)
+++ art.c	2009-04-03 21:49:55 UTC (rev 8400)
@@ -624,6 +624,8 @@
 /*
 **  Parse, check, and possibly store in the system header table a header that
 **  starts at cp->CurHeader.  size includes the trailing "\r\n".
+**  Even though an error has already occurred (cp->Error is set), we go on
+**  parsing headers (so that we can find the message-ID, the path, etc.).
 */
 static void
 ARTcheckheader(CHANNEL *cp, int size)
@@ -640,10 +642,6 @@
   /* Check whether we are receiving the article via IHAVE or TAKETHIS. */
   ihave = (cp->Sendid.size > 3) ? false : true;
 
-  /* If we've already found an error, don't parse any more headers. */
-  if (*cp->Error != '\0')
-    return;
-
   /* Find first colon */
   if ((colon = memchr(header, ':', size)) == NULL || !ISWHITE(colon[1])) {
     if ((p = memchr(header, '\r', size)) != NULL)
@@ -1961,8 +1959,9 @@
 
   /* If we don't have Path or Message-ID, we can't continue. */
   if (!artclean && (!HDR_FOUND(HDR__PATH) || !HDR_FOUND(HDR__MESSAGE_ID))) {
-    /* cp->Error is set since Path and Message-ID are required header and one
-       of two is not found at ARTclean(). */
+    /* cp->Error is set since Path: and Message-ID: are required headers and one
+     * of them is not found at ARTclean().
+     * We cannot remember the message-ID of this article. */
     ARTlog(data, ART_REJECT, cp->Error);
     ARTreject(REJECT_OTHER, cp);
     return false;
@@ -1971,6 +1970,8 @@
   if (hopcount == 0) {
     snprintf(cp->Error, sizeof(cp->Error), "%d illegal path element",
              ihave ? NNTP_FAIL_IHAVE_REJECT : NNTP_FAIL_TAKETHIS_REJECT);
+    /* We do not remember the message-ID of this article because another
+     * peer may send it with a good Path: header. */
     ARTlog(data, ART_REJECT, cp->Error);
     ARTreject(REJECT_OTHER, cp);
     return false;
@@ -2407,6 +2408,10 @@
                  ihave ? NNTP_FAIL_IHAVE_REJECT : NNTP_FAIL_TAKETHIS_REJECT);
       }
       ARTlog(data, ART_REJECT, cp->Error);
+      if (innconf->remembertrash && (Mode == OMrunning) &&
+          !InndHisRemember(HDR(HDR__MESSAGE_ID)))
+          syslog(L_ERROR, "%s cant write history %s %m",
+                 LogName, HDR(HDR__MESSAGE_ID));
       ARTreject(REJECT_OTHER, cp);
       return false;
     }

Modified: nc.c
===================================================================
--- nc.c	2009-04-03 19:35:29 UTC (rev 8399)
+++ nc.c	2009-04-03 21:49:55 UTC (rev 8400)
@@ -1000,6 +1000,15 @@
       /* If error is set, we're rejecting this article.  There is no need
        * to call ARTlog() as it has already been done during ARTparse(). */
       if (*cp->Error != '\0') {
+        if (innconf->remembertrash && (Mode == OMrunning)
+            && HDR_FOUND(HDR__MESSAGE_ID)) {
+            HDR_PARSE_START(HDR__MESSAGE_ID);
+            if (!HIScheck(History, HDR(HDR__MESSAGE_ID))
+                && !InndHisRemember(HDR(HDR__MESSAGE_ID)))
+                syslog(L_ERROR, "%s cant write history %s %m",
+                       LogName, HDR(HDR__MESSAGE_ID));
+            HDR_PARSE_END(HDR__MESSAGE_ID);
+        }
 	ARTreject(REJECT_OTHER, cp);
 	cp->State = CSgetcmd;
 	cp->Start = cp->Next;
@@ -1021,6 +1030,8 @@
       readmore = false;
       movedata = false;
       if (Mode == OMthrottled) {
+        /* We do not remember the message-ID of this article because it has not
+         * been stored. */
         ARTreject(REJECT_OTHER, cp);
         ARTlogreject(cp, ModeReason);
 	/* Clear the work-in-progress entry. */




More information about the inn-committers mailing list