~ubuntu-branches/ubuntu/edgy/awstats/edgy

« back to all changes in this revision

Viewing changes to wwwroot/cgi-bin/plugins/userinfo.pm

  • 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:
3
3
# UserInfo AWStats plugin
4
4
# This plugin allow you to add information on authenticated users chart from
5
5
# a text file. Like full user name and lastname.
6
 
# You must create a file called userinfo.configvalue.txt and store it in
7
 
# plugin directory that contains 2 columns separated by a tab char.
8
 
# First column is authenticated user login and second column is text
9
 
# you want add.
 
6
# You must create a file called userinfo.configvalue.txt wich contains 2
 
7
# columns separated by a tab char, and store it in DirData directory.
 
8
# First column is authenticated user login and second column is text you want
 
9
# to add.
10
10
#-----------------------------------------------------------------------------
11
11
# Perl Required Modules: None
12
12
#-----------------------------------------------------------------------------
13
 
# $Revision: 1.5 $ - $Author: eldy $ - $Date: 2003/12/22 02:00:52 $
 
13
# $Revision: 1.8 $ - $Author: eldy $ - $Date: 2004/06/11 21:34:32 $
14
14
 
15
15
 
16
16
# <-----
17
 
# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES.
 
17
# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
 
18
#if (!eval ('require "TheModule.pm";')) { return $@?"Error: $@":"Error: Need Perl module TheModule"; }
18
19
# ----->
19
20
use strict;no strict "refs";
20
21
 
49
50
 
50
51
        # <-----
51
52
        # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
52
 
        debug(" InitParams=$InitParams",1);
 
53
        debug(" Plugin userinfo: InitParams=$InitParams",1);
53
54
        $userinfoloaded=0;
54
55
        %UserInfo=();
55
56
        # ----->
62
63
#-----------------------------------------------------------------------------
63
64
# PLUGIN FUNCTION: ShowInfoUser_pluginname
64
65
# UNIQUE: NO (Several plugins using this function can be loaded)
65
 
# Function called to add additionnal information for Users in users' report.
66
 
# Parameters: URL
 
66
# Function called to add additionnal columns to Authenticated users report.
 
67
# This function is called when building rows of the report (One call for each
 
68
# row). So it allows you to add a column in report, for example with code :
 
69
#   print "<TD>This is a new cell</TD>";
 
70
# Parameters: User
67
71
#-----------------------------------------------------------------------------
68
72
sub ShowInfoUser_userinfo {
 
73
        my $param="$_[0]";
69
74
        # <-----
70
 
        my $userinfotoshow="$_[0]";
71
75
        my $filetoload='';
72
 
        if ($userinfotoshow && $userinfotoshow ne '__title__' && ! $userinfoloaded) {
 
76
        if ($param && $param ne '__title__' && ! $userinfoloaded) {
73
77
                # Load userinfo file
74
78
                if ($SiteConfig && open(USERINFOFILE,"$DirData/userinfo.$SiteConfig.txt"))      { $filetoload="$DirData/userinfo.$SiteConfig.txt"; }
75
79
                elsif (open(USERINFOFILE,"$DirData/userinfo.txt"))                                              { $filetoload="$DirData/userinfo.txt"; }
77
81
                # This is the fastest way to load with regexp that I know
78
82
                %UserInfo = map(/^([^\t]+)\t+([^\t]+)/o,<USERINFOFILE>);
79
83
                close USERINFOFILE;
80
 
                debug("UserInfo file loaded: ".(scalar keys %UserInfo)." entries found.");
 
84
                debug(" Plugin userinfo: UserInfo file loaded: ".(scalar keys %UserInfo)." entries found.");
81
85
                $userinfoloaded=1;
82
86
        }
83
 
        if ($userinfotoshow eq '__title__') {
 
87
        if ($param eq '__title__') {
84
88
                print "<th width=\"80\">$Message[114]</th>";    
85
89
        }
86
 
        elsif ($userinfotoshow) {
 
90
        elsif ($param) {
87
91
                print "<td>";
88
 
                if ($UserInfo{$userinfotoshow}) { print "$UserInfo{$userinfotoshow}"; }
 
92
                if ($UserInfo{$param}) { print "$UserInfo{$param}"; }
89
93
                else { print "&nbsp;"; }        # Undefined user info
90
94
                print "</td>";
91
95
        }