Package: logwatch
Version: 7.3.1-5
Severity: normal
Tags: patch

When logwatch fails to decompress a log file, there is no indication of
which file caused the problem.  Errors currently look like this:

  /etc/cron.daily/00logwatch:
  
  zcat: stdout: No space left on device
  system zcat failed: 256 at /usr/sbin/logwatch line 878.
  run-parts: /etc/cron.daily/00logwatch exited with return code 25

The attached patch adds the command arguments to the decompression error
messages (as is already done for some of the other system() calls).

Thanks!

-- 
Kees Cook                                            @outflux.net
diff -u logwatch-7.3.6/scripts/logwatch.pl logwatch-7.3.6/scripts/logwatch.pl
--- logwatch-7.3.6/scripts/logwatch.pl
+++ logwatch-7.3.6/scripts/logwatch.pl
@@ -876,18 +876,18 @@
          #For each filter to apply -mgt
             my $arguments = "$Archive >> $DestFile";
             system("$Config{'pathtozcat'} $arguments") == 0
-               or die "system $Config{'pathtozcat'} failed: $?" 
+               or die "system '$Config{'pathtozcat'} $arguments' failed: $?" 
          } elsif (($Archive =~ m/bz2$/) && (-f "$Archive")) {
          #These system calls are not secure but we are getting closer
          #What needs to go is all the pipes and instead we need a command loop
          #For each filter to apply -mgt
             my $arguments = "$Archive 2>/dev/null >> $DestFile";
             system("$Config{'pathtobzcat'} $arguments") == 0
-               or die "system $Config{'pathtobzcat'} failed: $?" 
+               or die "system '$Config{'pathtobzcat'} $arguments' failed: $?" 
          } elsif (-f "$Archive") {
             my $arguments = "$Archive  >> $DestFile";
             system("$Config{'pathtocat'} $arguments") == 0
-               or die "system $Config{'pathtocat'} failed: $?" 
+               or die "system '$Config{'pathtocat'} $arguments' failed: $?" 
          } #End if/elsif existence
       } #End if $CheckTime
 
@@ -965,7 +965,7 @@
       #What needs to go is all the pipes and instead we need a command loop
       #For each filter to apply -mgt
          system("$Config{'pathtocat'} $Command") == 0
-            or die "system $Config{'pathtocat'} $Command failed: $?" 
+            or die "system '$Config{'pathtocat'} $Command' failed: $?" 
       }
    }
 }
@@ -983,7 +983,7 @@
      my $eeefile = ("$TempDir" . "$newlogfile");
      if ((!(-d $eeefile)) && (!($eeefile =~ m/-archive/))) {
          system("$Config{'pathtocat'} $eeefile $ecpcmd") == 0
-            or die "system $Config{'pathtocat'} $eeefile $ecpcmd failed: $?" 
+            or die "system '$Config{'pathtocat'} $eeefile $ecpcmd' failed: $?" 
      }
    }
    #read in the final host list

Reply via email to