INN commit: trunk/frontends (scanspool.in)

INN Commit rra at isc.org
Tue Jul 5 18:13:39 UTC 2011


    Date: Tuesday, July 5, 2011 @ 11:13:39
  Author: iulius
Revision: 9214

add support for wire-formatted articles in scanspool

Remove \r from the Newsgroups: header field when parsing it.  Otherwise,
scanspool can not properly parse articles stored in wire-format, and
wrongly report that the article does not belong in its newsgroup.

Also initialize two variables, and make sure a hash value exists, to silent
three warnings during the execution of scanspool.

Modified:
  trunk/frontends/scanspool.in

--------------+
 scanspool.in |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Modified: scanspool.in
===================================================================
--- scanspool.in	2011-07-05 17:08:34 UTC (rev 9213)
+++ scanspool.in	2011-07-05 18:13:39 UTC (rev 9214)
@@ -306,8 +306,8 @@
     my $filename;               # article pathname under $spool
     my $artgrp;                 # group of an article
     my $artnum;                 # article number in a group
-    my $prevgrp;                # previous different value of $artgrp
-    my $preverrgrp;             # previous non-active $artgrp
+    my $prevgrp = '';           # previous different value of $artgrp
+    my $preverrgrp = '';        # previous non-active $artgrp
     my $ARTICLE;                # article handle
     my $aline;                  # header line from an article
     my @group;                  # array of groups from the Newsgroups: header
@@ -363,7 +363,7 @@
 	# note if the article is not in a directory that is used by
 	# a real (non-aliased) group in the active file
 	#
-	# If we complained about this dgroup before, don't complain again.
+	# If we complained about this group before, don't complain again.
 	# If verbose, note files that could be removed.
 	#
 	if (!defined $gname2type{$artgrp} || $gname2type{$artgrp} =~ /[=jx]/o){
@@ -413,10 +413,11 @@
 
 	    # catch the Newsgroups: header
 	    if ($aline =~ /^Newsgroups:\w*\W/io) {
-
 		# convert $aline into a comma separated list of groups
+                # remove both CR and LF from the header value (because the article may be
+                # stored in wire-format).
 		$aline =~ s/^Newsgroups://io;
-		$aline =~ tr/ \t\n//d;
+		$aline =~ tr/ \t\r\n//d;
 
 		# form an array of news groups
 		@group = split(",", $aline);
@@ -425,14 +426,14 @@
 		for (my $j=0; $j <= $#group; ++$j) {
 
 		    # look at the group
-		    if ($realgname{$group[$j]} eq $artgrp) {
+		    if (exists $realgname{$group[$j]} and $realgname{$group[$j]} eq $artgrp) {
 			# this article was posted to this group
 			last AREADLINE;
 		    }
 		}
 
 		# no group or group alias was found
-		problem("$filename: does not belong in $artgrp");
+		problem("$filename: does not belong in $artgrp according to its Newsgroups: header");
 		last;
 
 	    # else watch for the end of the header




More information about the inn-committers mailing list