INN commit: branches/2.5 (6 files)
INN Commit
rra at isc.org
Sun Jan 17 13:53:29 UTC 2010
Date: Sunday, January 17, 2010 @ 05:53:28
Author: iulius
Revision: 8901
The O flag in newsfeeds now relies on the contents of the
Injection-Info: header (or X-Trace: header if there is no
Injection-Info: header) to determine the origin of an article.
Make public the skip_cfws() function so as to skip CFWS
defined in RFC 5322.
Modified:
branches/2.5/doc/pod/newsfeeds.pod
branches/2.5/include/inn/libinn.h
branches/2.5/innd/art.c
branches/2.5/lib/Makefile
branches/2.5/lib/date.c
branches/2.5/lib/headers.c
-----------------------+
doc/pod/newsfeeds.pod | 19 ++++++++++---------
include/inn/libinn.h | 1 +
innd/art.c | 33 ++++++++++++++++++++++++++++++---
lib/Makefile | 3 ++-
lib/date.c | 47 +----------------------------------------------
lib/headers.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 90 insertions(+), 59 deletions(-)
Modified: doc/pod/newsfeeds.pod
===================================================================
--- doc/pod/newsfeeds.pod 2010-01-17 13:50:42 UTC (rev 8900)
+++ doc/pod/newsfeeds.pod 2010-01-17 13:53:28 UTC (rev 8901)
@@ -292,8 +292,8 @@
=item O
-Send articles to this site that don't have an X-Trace: header, even if the
-C<O> flag is also given.
+Send articles to this site that don't have an Injection-Info: or X-Trace:
+header, even if the C<O> flag is also given.
=item p
@@ -372,13 +372,14 @@
=item B<O> I<originator>
If this flag is specified, an article will only be sent to this site if it
-contains an X-Trace: header and the first field of this header matches
-I<originator>. I<originator> is a uwildmat(3) expression without commas or
-a list of such expressions, separated by C</>. The article is never sent
-if the first character of the pattern begins with C<@> and the rest of the
-pattern matches. One use of this flag is to restrict the feed to locally
-generated posts by using an I<originator> pattern that matches the
-X-Trace: header added by the local server.
+contains an Injection-Info: header (or an X-Trace: header if no
+Injection-Info: header is found) and the first field of this header matches
+I<originator>. I<originator> is a uwildmat(3) expression without commas
+or a list of such expressions, separated by C</>. The article is never
+sent if the first character of the pattern begins with C<@> and the rest
+of the pattern matches. One use of this flag is to restrict the feed to
+locally generated posts by using an I<originator> pattern that matches
+the Injection-Info: header added by the local server.
=item B<P> I<priority>
Modified: include/inn/libinn.h
===================================================================
--- include/inn/libinn.h 2010-01-17 13:50:42 UTC (rev 8900)
+++ include/inn/libinn.h 2010-01-17 13:53:28 UTC (rev 8901)
@@ -156,6 +156,7 @@
extern void InitializeMessageIDcclass(void);
extern bool IsValidMessageID(const char *string, bool stripspaces);
extern bool IsValidHeaderName(const char *string);
+extern const char * skip_cfws(const char *p);
extern void HeaderCleanFrom(char *from);
extern struct _DDHANDLE * DDstart(FILE *FromServer, FILE *ToServer);
extern void DDcheck(struct _DDHANDLE *h, char *group);
Modified: innd/art.c
===================================================================
--- innd/art.c 2010-01-17 13:50:42 UTC (rev 8900)
+++ innd/art.c 2010-01-17 13:53:28 UTC (rev 8901)
@@ -1645,7 +1645,7 @@
HDRCONTENT *hc = data->HdrContent;
SITE *sp, *funnel;
int i, j, Groupcount, Followcount, Crosscount;
- char *p, *q;
+ char *p, *q, *begin, savec;
struct buffer *bp;
bool sendit;
@@ -1662,10 +1662,37 @@
sp->Sendit = false;
if (sp->Originator) {
- if (!HDR_FOUND(HDR__XTRACE)) {
+ if (!HDR_FOUND(HDR__XTRACE) && !HDR_FOUND(HDR__INJECTION_INFO)) {
if (!sp->FeedwithoutOriginator)
continue;
- } else {
+ } else if (HDR_FOUND(HDR__INJECTION_INFO)) {
+ begin = (char *) skip_cfws(HDR(HDR__INJECTION_INFO));
+
+ if (begin == '\0')
+ continue;
+
+ /* The path identity ends with ';' or CFWS. */
+ for (p = begin; *p != ';' && *p != ' ' && *p != '\t' && *p != '\r'
+ && *p != '\0'; p++) ;
+ savec = *p;
+ *p = '\0';
+
+ for (j = 0, sendit = false; (q = sp->Originator[j]) != NULL; j++) {
+ if (*q == '@') {
+ if (uwildmat(begin, &q[1])) {
+ *p = savec;
+ sendit = false;
+ break;
+ }
+ } else {
+ if (uwildmat(begin, q))
+ sendit = true;
+ }
+ }
+ *p = savec;
+ if (!sendit)
+ continue;
+ } else if (HDR_FOUND(HDR__XTRACE)) {
if ((p = strchr(HDR(HDR__XTRACE), ' ')) != NULL) {
*p = '\0';
for (j = 0, sendit = false; (q = sp->Originator[j]) != NULL; j++) {
Modified: lib/Makefile
===================================================================
--- lib/Makefile 2010-01-17 13:50:42 UTC (rev 8900)
+++ lib/Makefile 2010-01-17 13:53:28 UTC (rev 8901)
@@ -130,7 +130,8 @@
../include/inn/libinn.h
date.o: date.c ../include/config.h ../include/inn/defines.h \
../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
- ../include/config.h ../include/inn/libinn.h ../include/inn/defines.h
+ ../include/config.h headers.c ../include/inn/libinn.h \
+ ../include/inn/defines.h
dbz.o: dbz.c ../include/config.h ../include/inn/defines.h \
../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
../include/config.h ../include/portable/mmap.h ../include/config.h \
Modified: lib/date.c
===================================================================
--- lib/date.c 2010-01-17 13:50:42 UTC (rev 8900)
+++ lib/date.c 2010-01-17 13:53:28 UTC (rev 8901)
@@ -8,6 +8,7 @@
#include "config.h"
#include "clibrary.h"
+#include "headers.c"
#include <ctype.h>
#include <time.h>
@@ -419,52 +420,6 @@
/*
-** Skip any amount of CFWS (comments and folding whitespace), the RFC 5322
-** grammar term for whitespace, CRLF pairs, and possibly nested comments that
-** may contain escaped parens. We also allow simple newlines since we don't
-** always deal with wire-format messages. Note that we do not attempt to
-** ensure that CRLF or a newline is followed by whitespace. Returns the new
-** position of the pointer.
-*/
-static const char *
-skip_cfws(const char *p)
-{
- int nesting = 0;
-
- for (; *p != '\0'; p++) {
- switch (*p) {
- case ' ':
- case '\t':
- case '\n':
- break;
- case '\r':
- if (p[1] != '\n' && nesting == 0)
- return p;
- break;
- case '(':
- nesting++;
- break;
- case ')':
- if (nesting == 0)
- return p;
- nesting--;
- break;
- case '\\':
- if (nesting == 0 || p[1] == '\0')
- return p;
- p++;
- break;
- default:
- if (nesting == 0)
- return p;
- break;
- }
- }
- return p;
-}
-
-
-/*
** Parse a single number. Takes the parsing rule that we're applying and
** returns a pointer to the new position of the parse stream. If there
** aren't enough digits, return NULL.
Modified: lib/headers.c
===================================================================
--- lib/headers.c 2010-01-17 13:50:42 UTC (rev 8900)
+++ lib/headers.c 2010-01-17 13:53:28 UTC (rev 8901)
@@ -40,3 +40,49 @@
return true;
}
+
+
+/*
+** Skip any amount of CFWS (comments and folding whitespace), the RFC 5322
+** grammar term for whitespace, CRLF pairs, and possibly nested comments that
+** may contain escaped parens. We also allow simple newlines since we don't
+** always deal with wire-format messages. Note that we do not attempt to
+** ensure that CRLF or a newline is followed by whitespace. Returns the new
+** position of the pointer.
+*/
+const char *
+skip_cfws(const char *p)
+{
+ int nesting = 0;
+
+ for (; *p != '\0'; p++) {
+ switch (*p) {
+ case ' ':
+ case '\t':
+ case '\n':
+ break;
+ case '\r':
+ if (p[1] != '\n' && nesting == 0)
+ return p;
+ break;
+ case '(':
+ nesting++;
+ break;
+ case ')':
+ if (nesting == 0)
+ return p;
+ nesting--;
+ break;
+ case '\\':
+ if (nesting == 0 || p[1] == '\0')
+ return p;
+ p++;
+ break;
+ default:
+ if (nesting == 0)
+ return p;
+ break;
+ }
+ }
+ return p;
+}
More information about the inn-committers
mailing list