controlchan patch for newgroup with no newsgroup

Russ Allbery rra at stanford.edu
Mon May 14 21:15:38 UTC 2001


Day before yesterday I got tons of warnings from the new controlchan
complaining about undefined values; I think I tracked it down to the case
of a control message with:

    Control: newgroup

without any actual newsgroup name.  Since controlchan runs with -w, this
ends up generating a bunch of undefined value warnings when controlchan
scans the active file looking for that newsgroup.

I think this patch fixes it and also fixes a minor logging bug that I
noticed by visual inspection.

Index: controlchan.in
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/control/controlchan.in,v
retrieving revision 1.1
diff -u -r1.1 controlchan.in
--- controlchan.in	2001/05/06 02:54:53	1.1
+++ controlchan.in	2001/05/14 21:15:23
@@ -112,7 +112,7 @@
 
     if ($action eq '_pgpfail') {
         my $type = '';
-        if ($progparams[0] and $progparams[0] eq 'newgroup') {
+        if ($progname and $progname eq 'newgroup') {
             if ($progparams[1] and $progparams[1] eq 'moderated') {
                 $type = 'm ';
             } else {
@@ -252,6 +252,15 @@
 
     my $action = 'drop';    # default
     my ($logname, $hier);
+
+    # newgroup and rmgroup require newsgroup names; check explicitly for that
+    # here and return drop if the newsgroup is missing (to avoid a bunch of
+    # warnings from undefined values later on in permission checking).
+    if ($type eq 'newgroup' or $type eq 'rmgroup') {
+        unless ($newsgroup) {
+            return ('drop', undef, undef);
+        }
+    }
 
     my $ctllist = readctlfile();
     foreach (@$ctllist) {

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>


More information about the inn-workers mailing list