INN commit: branches/2.5 (doc/pod/news.pod nnrpd/post.c)

INN Commit rra at isc.org
Sun Sep 26 15:19:00 UTC 2010


    Date: Sunday, September 26, 2010 @ 08:18:59
  Author: iulius
Revision: 9122

nnrpd no longer adds or updates the Path: header field when an article is
forwarded to a moderator.  It could otherwise lead to rejects at injection
time when the article was approved by the moderator because these fields
show a previous injection (which did not occur).

Note that if strippath is true, we will still remove the Path: header.
No harm done with that removal.


Excerpt from RFC 5537:

3.5.  Duties of an Injecting Agent

   7.   If the Newsgroups header contains one or more moderated groups
        and the proto-article does not contain an Approved header field,
        the injecting agent MUST either forward it to a moderator as
        specified in Section 3.5.1 or, if that is not possible, reject
        it.  This forwarding MUST be done after adding the Message-ID
        and Date headers if required, and before adding the Injection-
        Info and Injection-Date headers.

   8.   Otherwise, a Path header field with a <tail-entry> MUST be added
        if not already present.

   9.   The injecting agent MUST then update the Path header field as
        described in Section 3.2.1.

Modified:
  branches/2.5/doc/pod/news.pod
  branches/2.5/nnrpd/post.c

------------------+
 doc/pod/news.pod |    6 ++++++
 nnrpd/post.c     |   27 ++++++++++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2010-09-26 15:08:14 UTC (rev 9121)
+++ doc/pod/news.pod	2010-09-26 15:18:59 UTC (rev 9122)
@@ -52,6 +52,12 @@
 
 =item *
 
+B<nnrpd> no longer adds or updates the Path: header field when an article is
+forwarded to a moderator.  It could otherwise lead to rejects at injection
+time when the article was approved by the moderator.
+
+=item *
+
 It is now possible to run a script at the end of the execution of
 B<innshellvars> scripts.  If a file named F<innshellvars.local>,
 F<innshellvars.pl.local> or F<innshellvars.tcl.local> is present and

Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c	2010-09-26 15:08:14 UTC (rev 9121)
+++ nnrpd/post.c	2010-09-26 15:18:59 UTC (rev 9122)
@@ -314,7 +314,7 @@
 **  Return NULL if okay, or an error message.
 */
 static const char *
-ProcessHeaders(int linecount, char *idbuff, bool ihave)
+ProcessHeaders(int linecount, char *idbuff, bool ihave, bool needmoderation)
 {
     static char		MONTHS[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
     static char		datebuff[40];
@@ -429,7 +429,12 @@
         return "Missing Path: header";
     if (HDR(HDR__PATH) == NULL || PERMaccessconf->strippath) {
 	/* Note that innd will put host name here for us. */
-	HDR_SET(HDR__PATH, (char *) PATHMASTER);
+        /* If moderation is needed, do not update the Path: header field. */
+        if (!needmoderation)
+            HDR_SET(HDR__PATH, (char *) PATHMASTER);
+        else if (PERMaccessconf->strippath)
+            HDR_CLEAR(HDR__PATH);
+
 	if (VirtualPathlen > 0)
 	    addvirtual = true;
     } else {
@@ -462,7 +467,9 @@
         newpath = concat(".POSTED!", HDR(HDR__PATH), (char *) 0);
     }
 
-    HDR_SET(HDR__PATH, newpath);
+    /* If moderation is needed, do not update the Path: header field. */
+    if (!needmoderation)
+        HDR_SET(HDR__PATH, newpath);
 
     /* Reply-To: is left alone. */
     /* Sender: is set above. */
@@ -1035,14 +1042,20 @@
 	if ((error = CheckIncludedText(article, i)) != NULL)
 		return error;
     }
-    if ((error = ProcessHeaders(i, idbuff, ihave)) != NULL)
+
+    /* modgroup is set when moderated newsgroups are found in the
+     * Newsgroups: header field, and the article does not contain
+     * an Approved: header field.
+     * Therefore, moderation will be needed. */
+    if ((error = ValidNewsgroups(HDR(HDR__NEWSGROUPS), &modgroup)) != NULL)
+        return error;
+
+    if ((error = ProcessHeaders(i, idbuff, ihave, modgroup != NULL)) != NULL)
 	return error;
+
     if (i == 0 && HDR(HDR__CONTROL) == NULL)
 	return "Article is empty";
 
-    if ((error = ValidNewsgroups(HDR(HDR__NEWSGROUPS), &modgroup)) != NULL)
-	return error;
-
     strlcpy(frombuf, HDR(HDR__FROM), sizeof(frombuf));
     for (i = 0, p = frombuf;p < frombuf + sizeof(frombuf);)
 	if ((p = strchr(p, '\n')) == NULL)




More information about the inn-committers mailing list