INN commit: trunk (9 files)

INN Commit Russ_Allbery at isc.org
Sun Jan 18 18:58:18 UTC 2009


    Date: Sunday, January 18, 2009 @ 10:58:17
  Author: iulius
Revision: 8296

* Add a local control.ctl file, named control.ctl.local.
* Fix a bug in controlchan:  the time of modification of control.ctl
  is undefined if the file does not exist and a control article is received.
* Update the documentation of control.ctl with especially
  an example of use.
* Also fix a typo in the documentation of tally.control and control.ctl.
* Add a syntax check for control.ctl.local in inncheck.

close #95

Added:
  trunk/samples/control.ctl.local
Modified:
  trunk/MANIFEST
  trunk/control/controlchan.in
  trunk/doc/pod/control.ctl.pod
  trunk/doc/pod/tally.control.pod
  trunk/scripts/inncheck.in
  trunk/site/	(properties)
  trunk/site/Makefile
  trunk/support/mkmanifest

---------------------------+
 MANIFEST                  |    1 
 control/controlchan.in    |   61 ++++++++++++++++++++++++++++----------------
 doc/pod/control.ctl.pod   |   25 +++++++++++++-----
 doc/pod/tally.control.pod |    2 -
 samples/control.ctl.local |    9 ++++++
 scripts/inncheck.in       |    4 ++
 site/Makefile             |    8 ++++-
 support/mkmanifest        |    1 
 8 files changed, 79 insertions(+), 32 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2009-01-18 14:05:48 UTC (rev 8295)
+++ MANIFEST	2009-01-18 18:58:17 UTC (rev 8296)
@@ -625,6 +625,7 @@
 samples/actsync.ign                   Ignore file for actsync
 samples/buffindexed.conf.in           Buffindexed overview config file
 samples/control.ctl                   Access control for control messages
+samples/control.ctl.local             Local access control for control messages
 samples/cycbuff.conf                  Sample cycbuff.conf file
 samples/distrib.pats                  Default values for Distribution: header
 samples/distributions                 Recommended values for Distribution: header

Modified: control/controlchan.in
===================================================================
--- control/controlchan.in	2009-01-18 14:05:48 UTC (rev 8295)
+++ control/controlchan.in	2009-01-18 18:58:17 UTC (rev 8296)
@@ -232,35 +232,52 @@
     return $_;
 }
 
-# Read and cache control.ctl.
+# Read and cache control.ctl and control.ctl.local.
 sub readctlfile {
+    if (! -e $INN::Config::ctlfile) {
+        logdie("Cannot open $INN::Config::ctlfile: $!", 'crit');
+    }
+    my $localfile = (-e $INN::Config::ctlfile . '.local');
+
+    my @files = ($INN::Config::ctlfile);
     my $mtime = (stat($INN::Config::ctlfile))[9];
+
+    if ($localfile) {
+        push(@files, $INN::Config::ctlfile . '.local');
+        my $mtimelocalfile = (stat($INN::Config::ctlfile . '.local'))[9];
+        if ($mtimelocalfile > $mtime) {
+            $mtime = $mtimelocalfile;
+        }
+    }
+
     return $cachedctl if $lastctl == $mtime;    # mtime has not changed.
     $lastctl = $mtime;
 
     my @ctllist;
-    open(CTLFILE, $INN::Config::ctlfile)
-        or logdie("Cannot open $INN::Config::ctlfile: $!", 'crit');
-    while (<CTLFILE>) {
-        chop;
-        # Not a comment or blank? Convert wildmat to regex
-        next if not /^(\s+)?[^\#]/ or /^$/;
-        if (not /:(?:doit|doifarg|drop|log|mail|verify-.*)(?:=.*)?$/) {
-            s/.*://;
-            logmsg("$_ is not a valid action for control.ctl", 'err');
-            next;
+    foreach my $file (@files) {
+        open(CTLFILE, $file)
+            or logdie("Cannot open $file: $!", 'crit');
+        while (<CTLFILE>) {
+            chop;
+            # Not a comment or blank?  Convert wildmat to regex.
+            next if not /^(\s+)?[^\#]/ or /^$/;
+            if (not /:(?:doit|doifarg|drop|log|mail|verify-.*)(?:=.*)?$/) {
+                s/.*://;
+                logmsg("$_ is not a valid action for control.ctl", 'err');
+                next;
+            }
+            # Convert to a ':'-separated list of regexps.
+            s/^all:/*:/i;
+            s/([\$\+\.])/\\$1/g;
+            s/\*/.*/g;
+            s/\?/./g;
+            s/(.*)/^$1\$/;
+            s/:/\$:^/g;
+            s/\|/\$|^/g;
+            push(@ctllist, $_);
         }
-        # Convert to a : separated list of regexps
-        s/^all:/*:/i;
-        s/([\$\+\.])/\\$1/g;
-        s/\*/.*/g;
-        s/\?/./g;
-        s/(.*)/^$1\$/;
-        s/:/\$:^/g;
-        s/\|/\$|^/g;
-        push @ctllist, $_;
+        close(CTLFILE);
     }
-    close CTLFILE;
 
     logmsg('warning: control.ctl is empty!', 'err') if not @ctllist;
     return $cachedctl = [ reverse @ctllist ];
@@ -293,7 +310,7 @@
             $action =~ s/\\//g;
             $hier = $ctlline[2] if $type eq 'checkgroups';
             # @ctllist is a reversed list so the first match is the last
-            # one in control.ctl.
+            # one in control.ctl followed by control.ctl.local.
             last;
         }
     }

Modified: doc/pod/control.ctl.pod
===================================================================
--- doc/pod/control.ctl.pod	2009-01-18 14:05:48 UTC (rev 8295)
+++ doc/pod/control.ctl.pod	2009-01-18 18:58:17 UTC (rev 8296)
@@ -4,16 +4,25 @@
 
 =head1 DESCRIPTION
 
-F<control.ctl> in I<pathetc> is used to determine what action is taken
+The file I<pathetc>/control.ctl is used to determine what action is taken
 when a control message is received.  It is read by B<controlchan>, which
 is normally invoked as a channel program by B<innd>.  When F<control.ctl>
 is modified, B<controlchan> notices this automatically and reloads it.
 
+If a F<control.ctl.local> file exists in I<pathetc>, it is read by
+B<controlchan> after F<control.ctl> (the resulting behaviour is as
+though the contents of F<control.ctl.local> were at the end of
+F<control.ctl>).  This local file is formatted like F<control.ctl>
+and is intended to contain local customization.  It is also
+automatically reloaded when modified.
+
 Blank lines and lines beginning with a number sign (C<#>) are ignored.
 All other lines should consist of four fields separated by colons:
 
     <type>:<from>:<newsgroups>:<action>
 
+Lines are matched in order and the last matching line in the file will be used.
+
 The first field, <type>, is the type of control message for which this
 line is valid.  It should either be the name of a control message or the
 word C<all> to indicate that it applies to all control messages.
@@ -52,7 +61,7 @@
 useful for entries for sendsys control messages, allowing a site to
 request its own F<newsfeeds> entry by posting a C<sendsys mysite> control
 message, but not allowing the entire F<newsfeeds> file to be sent.  This
-was intended to partially counter so-called "sendsys bombs," where forged
+was intended to partially counter so-called "sendsys bombs", where forged
 sendsys control messages were used to mailbomb people.
 
 Processing sendsys control messages is not recommended even with this
@@ -85,7 +94,7 @@
 then PGP verification of the control message will be done and the user ID
 of the key of the authenticated signer will be checked against the
 expected identity defined by the rest of the string
-(C<news.announce.newgroups> in the above example.  This verification is
+(C<news.announce.newgroups> in the above example).  This verification is
 done via B<pgpverify>; see pgpverify(8) for more details.
 
 If no logging is specified (with =I<file> as mentioned below), logging will
@@ -134,9 +143,6 @@
 administrator will have to take action to implement the checkgroups
 message, and if that mail is ignored, nothing will be changed.
 
-Lines are matched in order and the last matching line in the file will be
-used.
-
 Use of the B<verify> action for processing newgroup, rmgroup, and
 checkgroups messages is STRONGLY recommended.  Abuse of control messages
 is rampant, and authentication via PGP signature is currently the only
@@ -168,6 +174,13 @@
 in the aus.* hierarchy is received, it too will be honored.  All other
 newgroup messages will be ignored.
 
+Besides, if a F<control.ctl.local> file exists and contains:
+
+    newgroup:*:comp.lang.*:drop
+
+then a newgroup control article for comp.lang.awk will not be honored
+even though it comes from C<group-admin at isc.org> with a valid signature.
+
 =head1 WARNINGS
 
 The third argument for a line affecting checkgroups does B<not> affect

Modified: doc/pod/tally.control.pod
===================================================================
--- doc/pod/tally.control.pod	2009-01-18 14:05:48 UTC (rev 8295)
+++ doc/pod/tally.control.pod	2009-01-18 18:58:17 UTC (rev 8296)
@@ -52,6 +52,6 @@
 
 =head1 SEE ALSO
 
-control.ctl(8), news.daily(8), newslog(5), scanlogs(8).
+control.ctl(5), news.daily(8), newslog(5), scanlogs(8).
 
 =cut

Added: samples/control.ctl.local
===================================================================
--- samples/control.ctl.local	                        (rev 0)
+++ samples/control.ctl.local	2009-01-18 18:58:17 UTC (rev 8296)
@@ -0,0 +1,9 @@
+##  $Id$
+##
+##  Sample control.ctl.local file.
+##
+##  It defines local access control for control messages.
+##  The rules in this file are executed after those defined
+##  in control.ctl.
+##  See the control.ctl man page for more information.
+


Property changes on: trunk/samples/control.ctl.local
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: scripts/inncheck.in
===================================================================
--- scripts/inncheck.in	2009-01-18 14:05:48 UTC (rev 8295)
+++ scripts/inncheck.in	2009-01-18 18:58:17 UTC (rev 8296)
@@ -17,6 +17,7 @@
     'badnews',		"$INN::Config::badnews",
     'batchdir',		"$INN::Config::pathoutgoing",
     'control.ctl',	"$INN::Config::ctlfile",
+    'control.ctl.local',"$INN::Config::ctlfile.local",
     'ctlprogs',		"$INN::Config::pathcontrol",
     'expire.ctl',	"$INN::Config::expirectl",
     'history',		"$INN::Config::history",
@@ -50,6 +51,7 @@
 %checklist = (
     'active',		'active',
     'control.ctl',	'control_ctl',
+    'control.ctl.local','control_ctl',
     'expire.ctl',	'expire_ctl',
     'incoming.conf',	'incoming_conf',
     'inn.conf',		'inn_conf',
@@ -140,7 +142,7 @@
 
 
 ##
-##  control.ctl
+##  The control.ctl and control.ctl.local files.
 ##
 %control'messages = (
     'all',		1,


Property changes on: trunk/site
___________________________________________________________________
Name: svn:ignore
   - INN.py
active.minimal
actsync.cfg
actsync.ign
buffindexed.conf
config
control.ctl
cycbuff.conf
distrib.pats
distributions
expire.ctl
filter.tcl
filter_innd.pl
filter_innd.py
filter_nnrpd.pl
incoming.conf
inn.conf
innfeed.conf
innreport.conf
innreport.css
innwatch.ctl
localgroups
moderators
motd.news
news2mail.cf
newsfeeds
newsgroups.minimal
nnrpd.py
nnrpd.track
nnrpd_access.pl
nnrpd_auth.pl
nnrpd_auth.py
nnrpd_access.py
nnrpd_dynamic.py
nntpsend.ctl
nocem.ctl
ovdb.conf
overview.fmt
passwd.nntp
radius.conf
readers.conf
sasl.conf
send-uucp.cf
startup.tcl
startup_innd.pl
storage.conf
subscriptions
update

   + INN.py
active.minimal
actsync.cfg
actsync.ign
buffindexed.conf
config
control.ctl
control.ctl.local
cycbuff.conf
distrib.pats
distributions
expire.ctl
filter.tcl
filter_innd.pl
filter_innd.py
filter_nnrpd.pl
incoming.conf
inn.conf
innfeed.conf
innreport.conf
innreport.css
innwatch.ctl
localgroups
moderators
motd.news
news2mail.cf
newsfeeds
newsgroups.minimal
nnrpd.py
nnrpd.track
nnrpd_access.pl
nnrpd_auth.pl
nnrpd_auth.py
nnrpd_access.py
nnrpd_dynamic.py
nntpsend.ctl
nocem.ctl
ovdb.conf
overview.fmt
passwd.nntp
radius.conf
readers.conf
sasl.conf
send-uucp.cf
startup.tcl
startup_innd.pl
storage.conf
subscriptions
update


Modified: site/Makefile
===================================================================
--- site/Makefile	2009-01-18 14:05:48 UTC (rev 8295)
+++ site/Makefile	2009-01-18 18:58:17 UTC (rev 8296)
@@ -27,6 +27,7 @@
 
 PATH_CONFIG		= ${PATHETC}/inn.conf
 PATH_CONTROLCTL		= ${PATHETC}/control.ctl
+PATH_CONTROLCTLLOCAL	= ${PATHETC}/control.ctl.local
 PATH_EXPIRECTL		= ${PATHETC}/expire.ctl
 PATH_INNDHOSTS		= ${PATHETC}/incoming.conf
 PATH_MODERATORS		= ${PATHETC}/moderators
@@ -59,7 +60,7 @@
 REST		= \
 	newsfeeds incoming.conf nnrpd.track passwd.nntp \
 	inn.conf moderators innreport.conf innreport.css localgroups \
-	control.ctl expire.ctl nntpsend.ctl overview.fmt \
+	control.ctl control.ctl.local expire.ctl nntpsend.ctl overview.fmt \
 	innwatch.ctl distrib.pats distributions actsync.cfg actsync.ign \
 	motd.news storage.conf cycbuff.conf buffindexed.conf \
 	innfeed.conf startup_innd.pl filter_innd.pl filter_nnrpd.pl \
@@ -76,7 +77,8 @@
 	$D$(PATH_NEWSFEEDS) $D$(PATH_INNDHOSTS) \
 	$D$(PATH_NNRPDTRACK) $D$(PATH_NNTPPASS) \
 	$D$(PATH_CONFIG) $D$(PATH_MODERATORS) \
-	$D$(PATH_CONTROLCTL) $D$(PATH_EXPIRECTL) $D$(PATHETC)/nntpsend.ctl \
+	$D$(PATH_CONTROLCTL) $D$(PATH_CONTROLCTLLOCAL) $D$(PATH_EXPIRECTL) \
+	$D$(PATHETC)/nntpsend.ctl \
 	$D$(PATHETC)/innreport.conf $D$(PATHHTTP)/innreport.css \
 	$D$(PATHETC)/localgroups \
 	$D$(PATH_CTLWATCH) $D$(PATH_DISTPATS) $D$(PATH_SCHEMA) \
@@ -182,6 +184,7 @@
 $D$(PATH_NNRPDTRACK):	nnrpd.track	; $(COPY_RPUB) $? $@
 $D$(PATH_SCHEMA):	overview.fmt	; $(COPY_RPUB) $? $@
 $D$(PATH_CONTROLCTL):	control.ctl	; $(COPY_RPUB) $? $@
+$D$(PATH_CONTROLCTLLOCAL): control.ctl.local	; $(COPY_RPUB) $? $@
 $D$(PATH_CTLWATCH):	innwatch.ctl	; $(COPY_RPUB) $? $@
 $D$(PATH_EXPIRECTL):	expire.ctl	; $(COPY_RPUB) $? $@
 $D$(PATH_CONFIG):	inn.conf	; $(COPY_RPUB) $? $@
@@ -233,6 +236,7 @@
 actsync.cfg:	../samples/actsync.cfg		; $(COPY) $? $@
 actsync.ign:	../samples/actsync.ign		; $(COPY) $? $@
 control.ctl:	../samples/control.ctl		; $(COPY) $? $@
+control.ctl.local: ../samples/control.ctl.local	; $(COPY) $? $@
 expire.ctl:	../samples/expire.ctl		; $(COPY) $? $@
 nnrpd_auth.pl:  ../samples/nnrpd_auth.pl	; $(COPY) $? $@
 nnrpd_access.pl:  ../samples/nnrpd_access.pl	; $(COPY) $? $@

Modified: support/mkmanifest
===================================================================
--- support/mkmanifest	2009-01-18 14:05:48 UTC (rev 8295)
+++ support/mkmanifest	2009-01-18 18:58:17 UTC (rev 8296)
@@ -208,6 +208,7 @@
 site/buffindexed.conf
 site/config
 site/control.ctl
+site/control.ctl.local
 site/cycbuff.conf
 site/distrib.pats
 site/distributions




More information about the inn-committers mailing list