INN commit: branches/2.5 (4 files)

INN Commit rra at isc.org
Sun Jan 24 10:46:27 UTC 2010


    Date: Sunday, January 24, 2010 @ 02:46:27
  Author: iulius
Revision: 8933

A new option has been added to inews.  When the "-m" flag is specified,
the corresponding value will be used to determine the maximum number of
header fields that are accepted for an article.  The default was 50
and it is now configurable.  Thanks to Torsten Jerzembeck for the bug report.

Modified:
  branches/2.5/CONTRIBUTORS
  branches/2.5/doc/pod/inews.pod
  branches/2.5/doc/pod/news.pod
  branches/2.5/frontends/inews.c

-------------------+
 CONTRIBUTORS      |    2 +-
 doc/pod/inews.pod |    7 ++++++-
 doc/pod/news.pod  |    7 +++++++
 frontends/inews.c |   15 ++++++++++-----
 4 files changed, 24 insertions(+), 7 deletions(-)

Modified: CONTRIBUTORS
===================================================================
--- CONTRIBUTORS	2010-01-24 10:45:14 UTC (rev 8932)
+++ CONTRIBUTORS	2010-01-24 10:46:27 UTC (rev 8933)
@@ -271,4 +271,4 @@
 David Hlacik, Andreas Mattheiss, James Ralston, Wim Lewis, Johan van Selst,
 Wolfgang M. Weyand, Berend Reitsma, William Kronert, Petr Novopashenniy,
 Steve Crook, John F. Morse, Tim Woodall, Jonathan Kamens, Kamil Jonca,
-S.P. Zeidler, Nix, Florian Schlichting
+S.P. Zeidler, Nix, Florian Schlichting, Torsten Jerzembeck

Modified: doc/pod/inews.pod
===================================================================
--- doc/pod/inews.pod	2010-01-24 10:45:14 UTC (rev 8932)
+++ doc/pod/inews.pod	2010-01-24 10:46:27 UTC (rev 8933)
@@ -4,7 +4,7 @@
 
 =head1 SYNOPSIS
 
-B<inews> [B<-ADhNORSVW>] [B<-acdeFfnortwx> I<value>] [B<-p> I<port>] [I<file>]
+B<inews> [B<-ADhNORSVW>] [B<-acdeFfmnortwx> I<value>] [B<-p> I<port>] [I<file>]
 
 =head1 DESCRIPTION
 
@@ -90,6 +90,11 @@
 desired headers have to be specified with command-line options as
 described above.
 
+=item B<-m> I<value>
+
+Articles that contain more than I<value> header fields are rejected.
+The default is C<50>.
+
 =item B<-O>
 
 By default, an Organization header will be added if none is present in the

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2010-01-24 10:45:14 UTC (rev 8932)
+++ doc/pod/news.pod	2010-01-24 10:46:27 UTC (rev 8933)
@@ -119,6 +119,13 @@
 
 =item *
 
+A new option has been added to B<inews>.  When the B<-m> flag is specified,
+the corresponding value will be used to determine the maximum number of
+header fields that are accepted for an article.  The default was C<50>
+and it is now configurable.  Thanks to Torsten Jerzembeck for the bug report.
+
+=item *
+
 The B<O> flag in F<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.

Modified: frontends/inews.c
===================================================================
--- frontends/inews.c	2010-01-24 10:45:14 UTC (rev 8932)
+++ frontends/inews.c	2010-01-24 10:46:27 UTC (rev 8933)
@@ -47,6 +47,7 @@
 } HEADER;
 
 static bool	Dump;
+static int      MaxHeadersCount;
 static bool	Revoked;
 static bool	Spooling;
 static char	**OtherHeaders;
@@ -221,7 +222,7 @@
     OtherCount = 0;
 
     /* Scan through buffer, a header at a time. */
-    for (i = 0, p = article; ; i++) {
+    for (i = 1, p = article; ; i++) {
 
 	if ((q = strchr(p, ':')) == NULL)
             die("no colon in header line \"%.30s...\"", p);
@@ -256,8 +257,8 @@
 	    }
 
 	/* Too many headers? */
-	if (++i > 5 * HEADER_DELTA)
-            die("more than %d lines of header", i);
+	if (i > MaxHeadersCount)
+            die("more than %d header fields", MaxHeadersCount);
 
 	/* No; add it to the set of other headers. */
 	if (hp == ARRAY_END(Table)) {
@@ -889,6 +890,7 @@
     /* Set defaults. */
     Mode = '\0';
     Dump = false;
+    MaxHeadersCount = 50;
     DoSignature = true;
     AddOrg = true;
     port = 0;
@@ -899,7 +901,7 @@
     umask(NEWSUMASK);
 
     /* Parse JCL. */
-    while ((i = getopt(ac, av, "DNAVWORShx:a:c:d:e:f:n:p:r:t:F:o:w:")) != EOF)
+    while ((i = getopt(ac, av, "DNAVWORShx:a:c:d:e:f:m:n:p:r:t:F:o:w:")) != EOF)
 	switch (i) {
 	default:
 	    Usage();
@@ -925,10 +927,13 @@
 	case 'h':
 	    Mode = i;
 	    break;
+        case 'm':
+            MaxHeadersCount = atoi(optarg);
+            break;
 	case 'x':
             Exclusions = concat(optarg, "!", (char *) 0);
 	    break;
-	 case 'p':
+	case 'p':
 	    port = atoi(optarg);
 	    break;
 	/* Header lines that can be specified on the command line. */




More information about the inn-committers mailing list