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

INN Commit rra at isc.org
Sun Jan 17 13:11:27 UTC 2010


    Date: Sunday, January 17, 2010 @ 05:11:27
  Author: iulius
Revision: 8897

Use "!!" as diag-match in the Path: header after the name
of the virtualhost when virtualhost: is set to true in
readers.conf and it is added at the beginning of the header.

Modified:
  branches/2.5/nnrpd/article.c

-----------+
 article.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Modified: article.c
===================================================================
--- article.c	2010-01-17 13:09:42 UTC (rev 8896)
+++ article.c	2010-01-17 13:11:27 UTC (rev 8897)
@@ -406,6 +406,7 @@
 	    return;
 	}
 	/* r points to the first space in the Xref: header. */
+
 	for (s = path, lastchar = '\0';
 	    s + VirtualPathlen + 1 < endofpath;
 	    lastchar = *s++) {
@@ -430,9 +431,11 @@
 	        SendIOv(s, p - s);
 	    }
 	} else {
+            /* Double the '!' (thus, adding one '!') in Path: header. */
 	    if (xref > path) {
 	        SendIOv(q, path - q);
 	        SendIOv(VirtualPath, VirtualPathlen);
+                SendIOv("!", 1);
 	        SendIOv(path, xref - path);
 	        SendIOv(VirtualPath, VirtualPathlen - 1);
 	        SendIOv(r, p - r);
@@ -441,6 +444,7 @@
 	        SendIOv(VirtualPath, VirtualPathlen - 1);
 	        SendIOv(r, path - r);
 	        SendIOv(VirtualPath, VirtualPathlen);
+                SendIOv("!", 1);
 	        SendIOv(path, p - path);
 	    }
 	}
@@ -525,11 +529,13 @@
 		else if (strncasecmp("Xref", header, headerlen) == 0)
 		    xrefheader = true;
 		if (retval == NULL) {
-		    retlen = q - p + VirtualPathlen + 1;
+                    /* Possibly add '!' (a second one) at the end of the virtual path.
+                     * So it is +2 because of '\0'. */
+		    retlen = q - p + VirtualPathlen + 2;
 		    retval = xmalloc(retlen);
 		} else {
-		    if ((q - p + VirtualPathlen + 1) > retlen) {
-			retlen = q - p + VirtualPathlen + 1;
+		    if ((q - p + VirtualPathlen + 2) > retlen) {
+			retlen = q - p + VirtualPathlen + 2;
                         retval = xrealloc(retval, retlen);
 		    }
 		}
@@ -558,8 +564,9 @@
 			*(retval + (int)(q - s)) = '\0';
 		    } else {
 			memcpy(retval, VirtualPath, VirtualPathlen);
-			memcpy(retval + VirtualPathlen, p, q - p);
-			*(retval + (int)(q - p) + VirtualPathlen) = '\0';
+                        *(retval + VirtualPathlen) = '!';
+			memcpy(retval + VirtualPathlen + 1, p, q - p);
+			*(retval + (int)(q - p) + VirtualPathlen + 1) = '\0';
 		    }
 		} else if (xrefheader && (VirtualPathlen > 0)) {
 		    if ((r = memchr(p, ' ', q - p)) == NULL)
@@ -567,6 +574,7 @@
 		    for (; (r < q) && isspace((int)*r) ; r++);
 		    if (r == q)
 			return NULL;
+                    /* Copy the virtual path without its final '!'. */
 		    memcpy(retval, VirtualPath, VirtualPathlen - 1);
 		    memcpy(retval + VirtualPathlen - 1, r - 1, q - r + 1);
 		    *(retval + (int)(q - r) + VirtualPathlen) = '\0';
@@ -880,6 +888,7 @@
     return field;
 }
 
+
 /*
 **  Dump parts of the overview database with the OVER command.
 **  The legacy XOVER is also kept, with its specific behaviour.
@@ -1032,6 +1041,7 @@
                 }
                 continue;
             }
+            /* Copy the virtual path without its final '!'. */
 	    if(useIOb) {
 		SendIOb(data, p - data);
 		SendIOb(VirtualPath, VirtualPathlen - 1);




More information about the inn-committers mailing list