INN commit: trunk/nnrpd (post.c)

INN Commit rra at isc.org
Sun Sep 26 16:20:45 UTC 2010


    Date: Sunday, September 26, 2010 @ 09:20:45
  Author: iulius
Revision: 9127

Do not add an Injection-Date: header when a message-ID and
a posting date are already present.

RFC 5537:
    If the proto-article had
    both a Message-ID header field and a Date header field, an
    Injection-Date header field MUST NOT be added, since the proto-
    article may have been multiply injected by a posting agent that
    predates this standard.  Otherwise, the injecting agent MUST add
    an Injection-Date header field containing the current date and
    time.

Modified:
  trunk/nnrpd/post.c

--------+
 post.c |   35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

Modified: post.c
===================================================================
--- post.c	2010-09-26 16:02:18 UTC (rev 9126)
+++ post.c	2010-09-26 16:20:45 UTC (rev 9127)
@@ -310,7 +310,7 @@
 
 
 /*
-**  Process all the headers.  FYI, they're done in RFC-order.
+**  Process all the headers.
 **  Return NULL if okay, or an error message.
 */
 static const char *
@@ -349,6 +349,25 @@
 	}
     }
 
+    /* Set the Injection-Date: header. */
+    /* Start with this header because it MUST NOT be added in case
+     * the article already contains both Message-ID: and Date:
+     * header fields (possibility of multiple injections). */
+    if (HDR(HDR__INJECTION_DATE) == NULL) {
+        /* If moderation is needed, do not add an Injection-Date: header field. */
+        if (!needmoderation && PERMaccessconf->addinjectiondate) {
+            if ((HDR(HDR__MESSAGEID) == NULL) || (HDR(HDR__DATE) == NULL)) {
+                HDR_SET(HDR__INJECTION_DATE, datebuff);
+            }
+        }
+    } else {
+        t = parsedate_rfc5322_lax(HDR(HDR__INJECTION_DATE));
+        if (t == (time_t) -1)
+            return "Can't parse Injection-Date: header";
+        if (t > now + DATE_FUZZ)
+            return "Article injected in the future";
+    }
+
     /* If authorized, add the header based on our info.  If not authorized,
      * zap the Sender: header so we don't put out unauthenticated data. */
     if (PERMaccessconf->nnrpdauthsender) {
@@ -499,20 +518,6 @@
 
     /* Supersedes: is left alone. */
 
-    /* Set the Injection-Date: header. */
-    if (HDR(HDR__INJECTION_DATE) == NULL) {
-        /* If moderation is needed, do not add an Injection-Date: header field. */
-        if (!needmoderation && PERMaccessconf->addinjectiondate) {
-            HDR_SET(HDR__INJECTION_DATE, datebuff);
-        }
-    } else {
-        t = parsedate_rfc5322_lax(HDR(HDR__INJECTION_DATE));
-        if (t == (time_t) -1)
-            return "Can't parse Injection-Date: header";
-        if (t > now + DATE_FUZZ)
-            return "Article injected in the future";
-    }
-
     /* Set the Injection-Info: header. */
     /* Set the path identity. */
     if (VirtualPathlen > 0) {




More information about the inn-committers mailing list