INN commit: trunk/control/modules (checkgroups.pl)
INN Commit
Russ_Allbery at isc.org
Sun Apr 26 07:52:35 UTC 2009
Date: Sunday, April 26, 2009 @ 00:52:35
Author: iulius
Revision: 8433
Be more precise in the mail sent to the administrator after
a checkgroups is handled by controlchan (specify whether
changes have been done, directly in the mail body).
Also prevent mod-active normal output from being logged
to errlog.
Modified:
trunk/control/modules/checkgroups.pl
----------------+
checkgroups.pl | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
Modified: checkgroups.pl
===================================================================
--- checkgroups.pl 2009-04-25 14:40:44 UTC (rev 8432)
+++ checkgroups.pl 2009-04-26 07:52:35 UTC (rev 8433)
@@ -143,15 +143,33 @@
}
if ($dochanges) {
+ open(OLDIN, '<&STDIN') or die $!;
+ open(OLDOUT, '>&STDOUT') or die $!;
+ open(STDIN, "$tempfile") or die $!;
+ open(STDOUT, ">$tempfile.modact") or die $!;
+
+ my $st = system("$INN::Config::pathbin/mod-active");
+ logdie('Cannot run mod-active: ' . $!) if $st == -1;
+ logdie('mod-active returned status ' . ($st & 255)) if $st > 0;
+
+ close(STDIN);
+ close(STDOUT);
+ open(STDIN, '<&OLDIN') or die $!;
+ open(STDOUT, '>&OLDOUT') or die $!;
+
if ($log) {
+ unshift(@output, '');
+ unshift(@output, '######################################################################');
+ unshift(@output, '# This script has already been successfully executed by controlchan. #');
+ unshift(@output, '######################################################################');
logger($log, "checkgroups by $sender processed (changes applied)",
\@output);
}
- my $st = system("$INN::Config::pathbin/mod-active",
- $tempfile);
- logdie('Cannot run mod-active: ' . $!) if $st == -1;
- logdie('mod-active returned status ' . ($st & 255)) if $st > 0;
} else {
+ unshift(@output, '');
+ unshift(@output, '################################################');
+ unshift(@output, '# This script was NOT executed by controlchan. #');
+ unshift(@output, '################################################');
logger($log || 'mail', "checkgroups by $sender *not* processed (too many changes)",
\@output);
}
@@ -159,7 +177,7 @@
logmsg("checkgroups by $sender processed (no change)");
}
close TEMPFILE;
- unlink($tempfile, "$tempfile.art");
+ unlink($tempfile, "$tempfile.art", "$tempfile.modact");
}
1;
More information about the inn-committers
mailing list