#2076 Log files still cleared even if report generation fails

1.180
closed
5
2005-05-12
2005-05-10
Anonymous
No

Although the subroutine "generate_report" in
webalizer-lib.pl returns 0 on failure, webalizer.pl
does not check the return code.

If the webserver logs have incorrect permissions then
webalizer can fail to read them (due to su'ing to the
account owner) but the log clearing runs as root. In
this instance you end up with no stats and no logs.

I'm running Webmin 1.180 from Debian Sarge but I
downloaded the latest webalizer module and it looks
like it hasn't changed.

The following (untested) patch should make the script
detect the failure and exit before clearing the logs:

--- webalizer.pl.orig 2005-05-10 16:44:32.122199626 +0100
+++ webalizer.pl 2005-05-10 16:46:49.651861508 +0100
@@ -8,7 +8,8 @@
$lconf || die "Logfile $ARGV[0] does not exist";

open(NULL, ">/dev/null");
-&generate_report($ARGV[0], NULL, 0);
+&generate_report($ARGV[0], NULL, 0) ||
+ die "Report generation failed for $ARGV[0]\n";
close(NULL);

if ($lconf->{'clear'}) {

Discussion

  • Jamie Cameron

    Jamie Cameron - 2005-05-12
    • status: open --> closed
     
  • Jamie Cameron

    Jamie Cameron - 2005-05-12

    Logged In: YES
    user_id=129364

    Thanks for pointing this out - I will fix this bug in the
    next Webmin release.

     

Log in to post a comment.