~ubuntu-branches/debian/sid/awstats/sid

« back to all changes in this revision

Viewing changes to tools/logresolvemerge.pl

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2005-02-05 17:13:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050205171348-h8uy32bhbcnhciie
Tags: 6.3-1
* New upstream release. Closes: bug#293702, #293668 (thanks to Nelson
  A. de Oliveira <naoliv@biolinux.df.ibilce.unesp.br>).
  + Includes upstream fix for security bug fixed in 6.2-1.1.
  + Includes upstream fix for most of security bug fixed in 6.2-1.1.
* Acknowledge NMUs. Closes: bug#291064, #294488 (thanks to Martin
  Schulze <joey@infodrom.org>, Martin Pitt <mpitt@debian.org>, Ubuntu,
  Joey Hess <joeyh@debian.org>, Frank Lichtenheld <djpig@debian.org> and Steve
  Langasek <vorlon@debian.org>).
* Include patch for last parts of security bug fixed in 6.2-1.1:
  01_sanitize_more.patch.
* Patch (02) to include snapshot of recent development:
  + Fix security hole that allowed a user to read log file content
    even when plugin rawlog was not enabled.
  + Fix a possible use of AWStats for a DoS attack.
  + configdir option was broken on windows servers.
  + DebugMessages is by default set to 0 for security reasons.
  + Minor fixes.
* References:
  CAN-2005-0435 - read server logs via loadplugin and pluginmode
  CAN-2005-0436 - code injection via PluginMode
  CAN-2005-0437 - directory traversal via loadplugin
  CAN-2005-0438 - information leak via debug

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
# alone for any other log analyzer.
7
7
# See COPYING.TXT file about AWStats GNU General Public License.
8
8
#-----------------------------------------------------------------------------
9
 
# $Revision: 1.29 $ - $Author: eldy $ - $Date: 2004/01/07 06:13:35 $
 
9
# $Revision: 1.31 $ - $Author: eldy $ - $Date: 2004/11/27 14:32:00 $
10
10
 
11
11
use strict; no strict "refs";
12
12
#use diagnostics;
34
34
 
35
35
# ---------- Init variables --------
36
36
use vars qw/ $REVISION $VERSION /;
37
 
$REVISION='$Revision: 1.29 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
 
37
$REVISION='$Revision: 1.31 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
38
38
$VERSION="1.2 (build $REVISION)";
39
39
 
40
40
use vars qw/ $NBOFLINESFORBENCHMARK /;
221
221
# Return:       -
222
222
#-----------------------------------------------------------------------------
223
223
sub Check_Thread_Use {
224
 
        if ($] >= 5.008) {      for (0..@ARGV-1) { if ($ARGV[$_] =~ /^-dnslookup=(\d{1,2})/i) {
 
224
        if ($] >= 5.008) {      for (0..@ARGV-1) { if ($ARGV[$_] =~ /^-dnslookup[:=](\d{1,2})/i) {
225
225
                if ($UseThread) {
226
226
                        if (!eval ('require "threads.pm";')) { &error("Failed to load perl module 'threads' required for multi-threaded DNS lookup".($@?": $@":"")); }
227
227
                        if (!eval ('require "threads/shared.pm";')) { &error("Failed to load perl module 'threads::shared' required for multi-threaded DNS lookup".($@?": $@":"")); }
243
243
        if ($ARGV[$_] =~ /^-/) {
244
244
                if ($ARGV[$_] =~ /debug=(\d)/i) { $Debug=$1; }
245
245
                elsif ($ARGV[$_] =~ /dnscache=/i) { $DNSLookup||=2; $DNSCache=$ARGV[$_]; $DNSCache =~ s/-dnscache=//; }
246
 
                elsif ($ARGV[$_] =~ /dnslookup=(\d{1,2})/i) { $DNSLookup||=1; $MaxNbOfThread=$1; }
 
246
                elsif ($ARGV[$_] =~ /dnslookup[:=](\d{1,2})/i) { $DNSLookup||=1; $MaxNbOfThread=$1; }
247
247
                elsif ($ARGV[$_] =~ /dnslookup/i) { $DNSLookup||=1; }
248
248
                elsif ($ARGV[$_] =~ /showsteps/i) { $ShowSteps=1; }
249
249
                elsif ($ARGV[$_] =~ /addfilenum/i) { $AddFileNum=1; }
294
294
        print "  perl $PROG.$Extension [options] *.* > newfile\n";
295
295
        print "Options:\n";
296
296
        print "  -dnslookup     make a reverse DNS lookup on IP adresses\n";
297
 
        print "  -dnslookup:n   same with a n parallel threads instead of serial requests\n";
 
297
        print "  -dnslookup=n   same with a n parallel threads instead of serial requests\n";
298
298
        print "  -dnscache=file make DNS lookup from cache file first before network lookup\n";
299
299
        print "  -showsteps     print on stderr benchmark information every $NBOFLINESFORBENCHMARK lines\n";
300
300
        print "  -addfilenum    if used with several files, file number can be added in first\n";
379
379
        open(CACHE, "<$DNSCache") or error("Can't open cache file $DNSCache");
380
380
        while (<CACHE>) {
381
381
                my ($time, $ip, $name) = split;
382
 
                $name='ip' if $name eq '*';
383
 
                $MyDNSTable{$ip}=$name;
 
382
        if ($ip && $name) {
 
383
            $name="$ip" if $name eq '*';
 
384
                $MyDNSTable{$ip}=$name;
 
385
        }
384
386
        }
385
387
        close CACHE;
386
388
}
502
504
        # END Read new lines for each log file. After this, following var are filled
503
505
        # $timerecord{$logfilenb}
504
506
 
505
 
        # We choose wich record of wich log file to process
506
 
        if ($Debug) { debug("Choose of wich record of which log file to process",3); }
 
507
        # We choose which record of which log file to process
 
508
        if ($Debug) { debug("Choose which record of which log file to process",3); }
507
509
        $logfilechosen=-1;
508
510
        my $timeref="99999999999999";
509
511
        foreach my $logfilenb (keys %LogFileToDo) {