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

INN Commit rra at isc.org
Sun Sep 26 15:08:14 UTC 2010


    Date: Sunday, September 26, 2010 @ 08:08:14
  Author: iulius
Revision: 9121

nnrpd no longer adds or updates Injection-Date:, Injection-Info:
and Path: header fields when the 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:
  trunk/doc/pod/news.pod
  trunk/nnrpd/post.c

------------------+
 doc/pod/news.pod |    7 +++++++
 nnrpd/post.c     |   34 +++++++++++++++++++++++++---------
 2 files changed, 32 insertions(+), 9 deletions(-)

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2010-09-26 11:37:05 UTC (rev 9120)
+++ doc/pod/news.pod	2010-09-26 15:08:14 UTC (rev 9121)
@@ -166,6 +166,13 @@
 
 =item *
 
+B<nnrpd> no longer adds or updates Injection-Date:, Injection-Info:
+and Path: header fields when the 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 11:37:05 UTC (rev 9120)
+++ nnrpd/post.c	2010-09-26 15:08:14 UTC (rev 9121)
@@ -314,7 +314,7 @@
 **  Return NULL if okay, or an error message.
 */
 static const char *
-ProcessHeaders(char *idbuff)
+ProcessHeaders(char *idbuff, bool needmoderation)
 {
     static char		datebuff[40];
     static char		localdatebuff[40];
@@ -413,7 +413,12 @@
     /* Set the 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 {
@@ -456,7 +461,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. */
@@ -494,7 +501,8 @@
 
     /* Set the Injection-Date: header. */
     if (HDR(HDR__INJECTION_DATE) == NULL) {
-        if (PERMaccessconf->addinjectiondate) {
+        /* If moderation is needed, do not add an Injection-Date: header field. */
+        if (!needmoderation && PERMaccessconf->addinjectiondate) {
             HDR_SET(HDR__INJECTION_DATE, datebuff);
         }
     } else {
@@ -550,7 +558,9 @@
              PERMaccessconf->addinjectionpostinghost ? postinghostbuff : "",
              (long) pid, complaintsbuff);
 
-    HDR_SET(HDR__INJECTION_INFO, injectioninfobuff);
+    /* If moderation is needed, do not add an Injection-Info: header field. */
+    if (!needmoderation)
+        HDR_SET(HDR__INJECTION_INFO, injectioninfobuff);
 
     /* Clear out some headers that should not be here. */
     if (PERMaccessconf->strippostcc) {
@@ -1033,14 +1043,20 @@
 	if ((error = CheckIncludedText(article, i)) != NULL)
 		return error;
     }
-    if ((error = ProcessHeaders(idbuff)) != 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(idbuff, 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