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

INN Commit rra at isc.org
Fri Jan 22 22:41:20 UTC 2010


    Date: Friday, January 22, 2010 @ 14:41:20
  Author: iulius
Revision: 8913

Add support for the "POSTED" diag-keyword in nnrpd, as described
in RFC 5537.  In particular, nnrpd checks that the article does
not already contain a "POSTED" diag-keyword.

Modified:
  branches/2.5/nnrpd/post.c

--------+
 post.c |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

Modified: post.c
===================================================================
--- post.c	2010-01-22 22:25:50 UTC (rev 8912)
+++ post.c	2010-01-22 22:41:20 UTC (rev 8913)
@@ -424,6 +424,17 @@
 	if (VirtualPathlen > 0)
 	    addvirtual = true;
     } else {
+        /* Check that the article has not been injected yet. */
+        for (p = HDR(HDR__PATH); *p != '\0'; p++) {
+            if (*p == '.' && strncasecmp(p, ".POSTED", 7) == 0
+                && (p[7] == '.' || p[7] == '!' || p[7] == ' ' || p[7] == '\t'
+                    || p[7] == '\r' || p[7] == '\n')
+                && (p == HDR(HDR__PATH) || p[-1] == '!')) {
+                return "Path: header shows a previous injection of the article";
+            }
+        }
+
+        /* Check whether the virtual host name is required. */
 	if ((VirtualPathlen > 0) &&
 	    (p = strchr(HDR(HDR__PATH), '!')) != NULL) {
 	    *p = '\0';
@@ -433,13 +444,17 @@
 	} else if (VirtualPathlen > 0)
 	    addvirtual = true;
     }
+
+    if (newpath != NULL)
+        free(newpath);
     if (addvirtual) {
-	if (newpath != NULL)
-	    free(newpath);
-        newpath = concat(VirtualPath, HDR(HDR__PATH), (char *) 0);
-	HDR_SET(HDR__PATH, newpath);
+        newpath = concat(VirtualPath, ".POSTED!", HDR(HDR__PATH), (char *) 0);
+    } else {
+        newpath = concat(".POSTED!", HDR(HDR__PATH), (char *) 0);
     }
 
+    HDR_SET(HDR__PATH, newpath);
+
     /* Reply-To: is left alone. */
     /* Sender: is set above. */
 




More information about the inn-committers mailing list