Article View: news.software.nntp
Article #81202Re: Another INN 2.5.0 rc2 bug - control.ctl processing
From: D. Stussy
Date: Tue, 02 Jun 2009 22:47
Date: Tue, 02 Jun 2009 22:47
158 lines
8009 bytes
8009 bytes
"Julien ΓLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:h02hfe$bki$1@news.trigofacile.com...
> > Well , if the pattern were "all:*:hierarchy1.*|*a*:log=...", then
> > "hierarchy5.*" would match, so I don't see a problem.
>
> It was just an example for "*a*"... Then consider "*z*".
Then a checkgroups for "hierarchy5.*" groups would NOT match *z*, yet
copying the message to a log file would still occur. That is wrong. No
matching groups means that the action should not occur.
> >> "hierarchy5" is not matched by "/.*binaries.*/" at all and therefore
not
> >> taken into account.
> >
> > Exactly the result I would expect. Remember that the checkgroups
parameter
> > is the hierarchy name (or pattern), not a fully-specified group name.
One
> > is comparing the hierarchy ROOT, not the names of groups therein.
>
> We're applying the pattern at the group name level here, as said in the
> documentation. Not at the top hierarchy level.
>
> "If the control message is a checkgroups, the third field is a
shell-style
> pattern matching the newsgroups that should be processed for checking."
>
>
> >> The same goes for a lot of other checkgroups features!
> >> Besides, the patch totally breaks "checkgroups !hr.admin hr".
> >
> > Which, as I understand it, is incorrect - as exclusion patterns must
trail.
>
> Where do you see that exclusion patterns *must* trail?!?
>
> control-command =/ Checkgroup-command
> Checkgroup-command = "checkgroups" Checkgroup-arguments
> Checkgroup-arguments= [ chkscope ] [ chksernr ]
> chkscope = 1*( 1*WSP ["!"] newsgroup-name )
> chksernr = 1*WSP "#" 1*DIGIT
The BNF syntax doesn't show it, but logically, one cannot have a "negative
hierarchy." Before one can have exclusions, one has to define from what
the exclusions apply to. It's common sense. As there is no "default
scope" (of groups, thus a NULL set), the scope must first include before it
can exclude. The BNF may describe "checkgroups !hr.admin hr" as
syntactically correct, but it is semantically wrong. I would read it as
covering all of "hr.*" INCLUDING "hr.admin"(.*) since the negation is
overridden by a subsequent pattern that reincludes it and is thusly
ignored. Multiple patterns are applied left to right in order of
occurance.
> > I think that what you're telling me is that the process is comparing
the
> > lines against individual groups filtering the contents of the
checkgroups
> > message, but the problem is that when NOTHING matches, it's still
executing
> > the action from control.ctl. That's why it's wrong. Where there's no
> > match, nothing should be done.
>
> I understand that point. Note that nothing is currently done (except
when
> the action is "log" -- and it is something I will try to improve).
...And that's the problem I have. Action "log=_logfile_" is being executed
for every NON-group-matching line in my control.ctl file(s).
That's why I suggested a flag or counter of matching lines. One cannot use
"newbody" alone because it includes lines not excluded, which need not be
the same as matching lines. Newbody may include text before the newsgroup
list (e.g. a paragraph describing what a checkgroups message is [*]), and
thus it could be not-null while also failing to have any line that matches
the inclusion pattern(s). A malicious checkgroups message could include
out-of-hierarchy groups.
I would prefer a counter over a flag, because the count could be useful as
a verification datum after changes are applied.
* - Even if the standards forbid a descriptive text, the implementation
doesn't.
> > Checkgroups doesn't match the "last" line;
> > as implemented, it matches ALL lines from control.ctl (with a matching
> > message sender), such being contrary to "Lines are matched in order and
the
> > last matching line in the file will be used" (from the manual page).
> > Matching all lines isn't matching just the last.
>
> I think you are skipping the last part of the sentence...
> which is present in INN 2.5.0 rc2 (according to the subject of your
thread):
>
> http://www.eyrie.org/~eagle/software/inn/docs/control.ctl.html
>
> "Lines are matched in order and the last matching line in the file
will
> be used, except for checkgroups messages which are handled
differently
> (every matching line is used)."
That URL does not mirror the manual page that I was seeing as installed as
part of the INN package for "control.ctl". Apparently, my man program on
my backup machine was pulling up an older (from INN 2.4.5) version of the
page. Therefore, I was acting under a different premise of the documented
behavior. However, the bug is still there.
This means modifying control//modules/checkgroups.pl. As long as we're
doing that, I wonder whether the correct default character set should be
"cp1252" as opposed to ASCII ("us-ascii") or UTF-8.
Forget the other patch. I think adding a counter solves the issue:
--- checkgroups.pl 2009-04-25 14:50:23.000000000 +0000
+++ checkgroups.pl.mod 2009-06-02 22:44:46.000000000 +0000
@@ -26,6 +26,7 @@
my @headers = split(/\r?\n/, $head->stringify);
my @body = split(/\r?\n/, $article->stringify_body);
my @newbody;
+ my $counter = 0;
my $charset_message;
if (defined $head->mime_attr('Content-Type.charset')) {
@@ -37,6 +38,7 @@
my $charset_newsgroup = $charset_message;
next if ($ngname =~ /$exclusionpats/ or $ngname =~ /$droppats/);
+ $counter++ if ($ngname =~ /$newsgrouppats/);
# Find the right charset if absent or forced by control.ctl.
foreach (@$charset_from) {
@@ -61,6 +63,7 @@
Encode::from_to($ngdesc, $charset_newsgroup, $charset_to);
push(@newbody, $ngname."\t".$ngdesc);
}
+ return if ($counter < 1);
if ($action eq 'mail' and $#newbody >= 0) {
my $mail = sendmail("checkgroups by $sender");
@@ -75,7 +78,8 @@
$INN::Config::pathbin/docheckgroups -u '$newsgrouppats' '$exclusionpats'
<<zRbJ
END
print $mail map { s/^~/~~/; "$_\n" } @newbody;
- print $mail "zRbJ\n";
+ print $mail "zRbJ\n\n$counter group".(($counter != 1) ? 's' : '')
..
+ " listed.\n";
close $mail or logdie("Cannot send mail: $!");
} elsif ($action eq 'log') {
if ($log) {
The last segment of the patch (line 75->78) is optional, but perhaps nice
for the "mail" operation to have the count of matching groups.
Technical Details
Message-ID:
<h04a6c$44k$1@aux.snarked.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder1.news.weretis.net!news.snarked.org!not-for-mailReferences:
<gvpshs$7c4$1@aux.snarked.org> <gvqsba$6o2$1@news.trigofacile.com> <gvsgbm$gfm$1@aux.snarked.org> <gvtjcl$nmf$1@news.trigofacile.com> <gvut8f$l3m$1@aux.snarked.org> <gvv0ha$21b$1@news.trigofacile.com> <gvv6uq$mvv$1@aux.snarked.org> <h004v2$4d1$1@news.trigofacile.com> <h025go$vin$1@aux.snarked.org> <h02hfe$bki$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <h04a6c$44k$1@aux.snarked.org> Subject: Re: Another INN 2.5.0 rc2 bug - control.ctl processing Date: Tue, 2 Jun 2009 15:47:42 -0700 From: "D. Stussy" <spam@bde-arc.ampr.org> References: <gvpshs$7c4$1@aux.snarked.org> <gvqsba$6o2$1@news.trigofacile.com> <gvsgbm$gfm$1@aux.snarked.org> <gvtjcl$nmf$1@news.trigofacile.com> <gvut8f$l3m$1@aux.snarked.org> <gvv0ha$21b$1@news.trigofacile.com> <gvv6uq$mvv$1@aux.snarked.org> <h004v2$4d1$1@news.trigofacile.com> <h025go$vin$1@aux.snarked.org> <h02hfe$bki$1@news.trigofacile.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder1.news.weretis.net!news.snarked.org!not-for-mail Newsgroups: news.software.nntp Lines: 158 Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org> NNTP-Posting-Host: pool-71-106-211-188.lsanca.dsl-w.verizon.net X-Trace: aux.snarked.org 1243982860 4244 71.106.211.188 (2 Jun 2009 22:47:40 GMT) X-Complaints-To: newsmaster@snarked.org NNTP-Posting-Date: Tue, 2 Jun 2009 22:47:40 +0000 (UTC) X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478