diff --git a/.cvsignore b/.cvsignore index 7c5881f..20be2b7 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -awstats-6.6.tar.gz +awstats-6.7.tar.gz diff --git a/awstats-6.7-xmlhistory.patch b/awstats-6.7-xmlhistory.patch new file mode 100644 index 0000000..a73750c --- /dev/null +++ b/awstats-6.7-xmlhistory.patch @@ -0,0 +1,325 @@ +--- wwwroot/cgi-bin/awstats.pl 2007/07/07 11:00:05 1.892 ++++ wwwroot/cgi-bin/awstats.pl 2007/07/12 21:38:20 1.894 +@@ -2211,7 +2211,7 @@ + } + + # Analyze fields +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); + if (! $field[0]) { next; } + + # Here version MUST be defined +@@ -2282,7 +2282,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_MISC' || $field[0] eq "${xmleb}END_MISC" || ! $_); + if ($field[0] ne 'END_MISC' && $field[0] ne "${xmleb}END_MISC") { error("History file \"$filetoread\" is corrupted (End of section MISC not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2313,7 +2313,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_CLUSTER' || $field[0] eq "${xmleb}END_CLUSTER" || ! $_); + if ($field[0] ne 'END_CLUSTER' && $field[0] ne "${xmleb}END_CLUSTER") { error("History file \"$filetoread\" is corrupted (End of section CLUSTER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2357,7 +2357,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_TIME' || $field[0] eq "${xmleb}END_TIME" || ! $_); + if ($field[0] ne 'END_TIME' && $field[0] ne "${xmleb}END_TIME") { error("History file \"$filetoread\" is corrupted (End of section TIME not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2396,7 +2396,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_ORIGIN' || $field[0] eq "${xmleb}END_ORIGIN" || ! $_); + if ($field[0] ne 'END_ORIGIN' && $field[0] ne "${xmleb}END_ORIGIN") { error("History file \"$filetoread\" is corrupted (End of section ORIGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2427,7 +2427,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_DAY' || $field[0] eq "${xmleb}END_DAY" || ! $_); + if ($field[0] ne 'END_DAY' && $field[0] ne "${xmleb}END_DAY") { error("History file \"$filetoread\" is corrupted (End of section DAY not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2534,7 +2534,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_VISITOR' || $field[0] eq "${xmleb}END_VISITOR" || ! $_); + if ($field[0] ne 'END_VISITOR' && $field[0] ne "${xmleb}END_VISITOR") { error("History file \"$filetoread\" is corrupted (End of section VISITOR not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2564,7 +2564,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_UNKNOWNIP' || $field[0] eq "${xmleb}END_UNKNOWNIP" || ! $_); + if ($field[0] ne 'END_UNKNOWNIP' && $field[0] ne "${xmleb}END_UNKNOWNIP") { error("History file \"$filetoread\" is corrupted (End of section UNKOWNIP not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2602,7 +2602,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_LOGIN' || $field[0] eq "${xmleb}END_LOGIN" || ! $_); + if ($field[0] ne 'END_LOGIN' && $field[0] ne "${xmleb}END_LOGIN") { error("History file \"$filetoread\" is corrupted (End of section LOGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2632,7 +2632,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_DOMAIN' || $field[0] eq "${xmleb}END_DOMAIN" || ! $_); + if ($field[0] ne 'END_DOMAIN' && $field[0] ne "${xmleb}END_DOMAIN") { error("History file \"$filetoread\" is corrupted (End of section DOMAIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2660,7 +2660,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_SESSION' || $field[0] eq "${xmleb}END_SESSION" || ! $_); + if ($field[0] ne 'END_SESSION' && $field[0] ne "${xmleb}END_SESSION") { error("History file \"$filetoread\" is corrupted (End of section SESSION not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2689,7 +2689,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_OS' || $field[0] eq "${xmleb}END_OS" || ! $_); + if ($field[0] ne 'END_OS' && $field[0] ne "${xmleb}END_OS") { error("History file \"$filetoread\" is corrupted (End of section OS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2717,7 +2717,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_BROWSER' || $field[0] eq "${xmleb}END_BROWSER" || ! $_); + if ($field[0] ne 'END_BROWSER' && $field[0] ne "${xmleb}END_BROWSER") { error("History file \"$filetoread\" is corrupted (End of section BROWSER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2745,7 +2745,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_UNKNOWNREFERER' || $field[0] eq "${xmleb}END_UNKNOWNREFERER" || ! $_); + if ($field[0] ne 'END_UNKNOWNREFERER' && $field[0] ne "${xmleb}END_UNKNOWNREFERER") { error("History file \"$filetoread\" is corrupted (End of section UNKNOWNREFERER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2773,7 +2773,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_UNKNOWNREFERERBROWSER' || $field[0] eq "${xmleb}END_UNKNOWNREFERERBROWSER" || ! $_); + if ($field[0] ne 'END_UNKNOWNREFERERBROWSER' && $field[0] ne "${xmleb}END_UNKNOWNREFERERBROWSER") { error("History file \"$filetoread\" is corrupted (End of section UNKNOWNREFERERBROWSER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2801,7 +2801,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_SCREENSIZE' || $field[0] eq "${xmleb}END_SCREENSIZE" || ! $_); + if ($field[0] ne 'END_SCREENSIZE' && $field[0] ne "${xmleb}END_SCREENSIZE") { error("History file \"$filetoread\" is corrupted (End of section SCREENSIZE not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2832,7 +2832,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_ROBOT' || $field[0] eq "${xmleb}END_ROBOT" || ! $_); + if ($field[0] ne 'END_ROBOT' && $field[0] ne "${xmleb}END_ROBOT") { error("History file \"$filetoread\" is corrupted (End of section ROBOT not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2862,7 +2862,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_WORMS' || $field[0] eq "${xmleb}END_WORMS" || ! $_); + if ($field[0] ne 'END_WORMS' && $field[0] ne "${xmleb}END_WORMS") { error("History file \"$filetoread\" is corrupted (End of section WORMS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2892,7 +2892,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_EMAILSENDER' || $field[0] eq "${xmleb}END_EMAILSENDER" || ! $_); + if ($field[0] ne 'END_EMAILSENDER' && $field[0] ne "${xmleb}END_EMAILSENDER") { error("History file \"$filetoread\" is corrupted (End of section EMAILSENDER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2922,7 +2922,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_EMAILRECEIVER' || $field[0] eq "${xmleb}END_EMAILRECEIVER" || ! $_); + if ($field[0] ne 'END_EMAILRECEIVER' && $field[0] ne "${xmleb}END_EMAILRECEIVER") { error("History file \"$filetoread\" is corrupted (End of section EMAILRECEIVER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -2984,7 +2984,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_SIDER' || $field[0] eq "${xmleb}END_SIDER" || ! $_); + if ($field[0] ne 'END_SIDER' && $field[0] ne "${xmleb}END_SIDER") { error("History file \"$filetoread\" is corrupted (End of section SIDER not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3016,7 +3016,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_FILETYPES' || $field[0] eq "${xmleb}END_FILETYPES" || ! $_); + if ($field[0] ne 'END_FILETYPES' && $field[0] ne "${xmleb}END_FILETYPES") { error("History file \"$filetoread\" is corrupted (End of section FILETYPES not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3066,7 +3066,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_SEREFERRALS' || $field[0] eq "${xmleb}END_SEREFERRALS" || ! $_); + if ($field[0] ne 'END_SEREFERRALS' && $field[0] ne "${xmleb}END_SEREFERRALS") { error("History file \"$filetoread\" is corrupted (End of section SEREFERRALS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3109,7 +3109,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_PAGEREFS' || $field[0] eq "${xmleb}END_PAGEREFS" || ! $_); + if ($field[0] ne 'END_PAGEREFS' && $field[0] ne "${xmleb}END_PAGEREFS") { error("History file \"$filetoread\" is corrupted (End of section PAGEREFS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3173,7 +3173,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_SEARCHWORDS' || $field[0] eq "${xmleb}END_SEARCHWORDS" || ! $_); + if ($field[0] ne 'END_SEARCHWORDS' && $field[0] ne "${xmleb}END_SEARCHWORDS") { error("History file \"$filetoread\" is corrupted (End of section SEARCHWORDS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3210,7 +3210,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_KEYWORDS' || $field[0] eq "${xmleb}END_KEYWORDS" || ! $_); + if ($field[0] ne 'END_KEYWORDS' && $field[0] ne "${xmleb}END_KEYWORDS") { error("History file \"$filetoread\" is corrupted (End of section KEYWORDS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3239,7 +3239,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq 'END_ERRORS' || $field[0] eq "${xmleb}END_ERRORS" || ! $_); + if ($field[0] ne 'END_ERRORS' && $field[0] ne "${xmleb}END_ERRORS") { error("History file \"$filetoread\" is corrupted (End of section ERRORS not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3271,7 +3271,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq "END_SIDER_$code" || $field[0] eq "${xmleb}END_SIDER_$code" || ! $_); + if ($field[0] ne "END_SIDER_$code" && $field[0] ne "${xmleb}END_SIDER_$code") { error("History file \"$filetoread\" is corrupted (End of section SIDER_$code not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3304,7 +3304,7 @@ + } + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq "END_EXTRA_$extranum" || $field[0] eq "${xmleb}END_EXTRA_$extranum" || ! $_); + if ($field[0] ne "END_EXTRA_$extranum" && $field[0] ne "${xmleb}END_EXTRA_$extranum") { error("History file \"$filetoread\" is corrupted (End of section EXTRA_$extranum not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); } +@@ -3352,7 +3352,7 @@ + do { + $_=; + chomp $_; s/\r//; +- @field=split(/\s+/,($readxml?CleanFromTags($_):$_)); $countlines++; ++ @field=split(/\s+/,($readxml?XMLDecodeFromHisto($_):$_)); $countlines++; + } + until ($field[0] eq "END_PLUGIN_$pluginname" || $field[0] eq "${xmleb}END_PLUGIN_$pluginname" || ! $_); + } +@@ -3811,13 +3811,13 @@ + $keysinkeylist{$_}=1; + my $newkey=$_; + $newkey =~ s/([^:])\/\//$1\//g; # Because some targeted url were taped with 2 / (Ex: //rep//file.htm). We must keep http://rep/file.htm +- print HISTORYTMP "${xmlrb}$newkey${xmlrs}".int($_url_p{$_}||0)."${xmlrs}".int($_url_k{$_}||0)."${xmlrs}".int($_url_e{$_}||0)."${xmlrs}".int($_url_x{$_}||0)."${xmlre}\n"; ++ print HISTORYTMP "${xmlrb}".XMLEncodeForHisto($newkey)."${xmlrs}".int($_url_p{$_}||0)."${xmlrs}".int($_url_k{$_}||0)."${xmlrs}".int($_url_e{$_}||0)."${xmlrs}".int($_url_x{$_}||0)."${xmlre}\n"; + } + foreach (keys %_url_p) { + if ($keysinkeylist{$_}) { next; } + my $newkey=$_; + $newkey =~ s/([^:])\/\//$1\//g; # Because some targeted url were taped with 2 / (Ex: //rep//file.htm). We must keep http://rep/file.htm +- print HISTORYTMP "${xmlrb}$newkey ".int($_url_p{$_}||0)."${xmlrs}".int($_url_k{$_}||0)."${xmlrs}".int($_url_e{$_}||0)."${xmlrs}".int($_url_x{$_}||0)."${xmlre}\n"; ++ print HISTORYTMP "${xmlrb}".XMLEncodeForHisto($newkey)."${xmlrs}".int($_url_p{$_}||0)."${xmlrs}".int($_url_k{$_}||0)."${xmlrs}".int($_url_e{$_}||0)."${xmlrs}".int($_url_x{$_}||0)."${xmlre}\n"; + } + print HISTORYTMP "${xmleb}END_SIDER${xmlee}\n"; + } +@@ -4340,7 +4340,8 @@ + } + + #------------------------------------------------------------------------------ +-# Function: Transforms spaces into %20 and special chars by entities as needed in XML/XHTML ++# Function: Transforms spaces into %20 and special chars by HTML entities as needed in XML/XHTML ++# Decoding is done by XMLDecodeFromHisto + # Parameters: stringtoencode + # Return: encodedstring + #------------------------------------------------------------------------------ +@@ -4348,6 +4349,7 @@ + my $string = shift; + $string =~ s/\s/%20/g; + if ($BuildHistoryFormat ne 'xml') { return $string; } ++ $string =~ s/=/%3d/g; + $string =~ s/&/&/g; + $string =~ s//>/g; +@@ -4445,10 +4447,16 @@ + # Output: None + # Return: decodedstring + #------------------------------------------------------------------------------ +-sub CleanFromTags { ++sub XMLDecodeFromHisto { + my $stringtoclean=shift; + $stringtoclean =~ s/$regclean1/ /g; # Replace or with space +- $stringtoclean =~ s/$regclean2//g; # Remove ++ $stringtoclean =~ s/$regclean2//g; # Remove others ++ $stringtoclean =~ s/%3d/=/g; ++ $stringtoclean =~ s/&/&/g; ++ $stringtoclean =~ s/<//g; ++ $stringtoclean =~ s/"/\"/g; ++ $stringtoclean =~ s/'/\'/g; + return $stringtoclean; + } + diff --git a/awstats.spec b/awstats.spec index 725b7a9..79f2c66 100644 --- a/awstats.spec +++ b/awstats.spec @@ -1,19 +1,25 @@ Name: awstats -Version: 6.6 +Version: 6.7 Release: 1%{?dist} Summary: Advanced Web Statistics License: GPL Group: Applications/Internet URL: http://awstats.sourceforge.net -Source0: http://dl.sf.net/awstats/awstats-6.6.tar.gz +Source0: http://dl.sf.net/awstats/awstats-%{version}.tar.gz #Source0: http://awstats.sourceforge.net/files/awstats-6.6.tar.gz Source1: awstats.README.SELinux + +# Fix pb in xml output for history files +# http://awstats.cvs.sourceforge.net/awstats/awstats/wwwroot/cgi-bin/awstats.pl?r1=1.892&r2=1.894&view=patch +Patch0: awstats-6.7-xmlhistory.patch + BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: checkpolicy, selinux-policy-devel Requires: httpd Requires: perl -Requires(post): perl, policycoreutils -Requires(postun): /sbin/service, policycoreutils +Requires(post): perl +Requires(postun): /sbin/service %description Advanced Web Statistics is a powerful and featureful tool that generates @@ -31,9 +37,23 @@ The program also supports virtual servers, plugins and a lot of features. With the default configuration, the statistics are available: http://localhost/awstats/awstats.pl +%package selinux +Summary: SELinux support for Awstats +Group: Applications/Internet +Requires: %{name} = %{version} +Requires(post): policycoreutils +Requires(preun): policycoreutils +Requires(postun): policycoreutils + +%description selinux +This package adds SELinux enforcement to AWstats. + %prep %setup -q +# No backup or it will be installed +#%%patch0 -p0 -b .xmlhistory +%patch0 -p0 # Fix style sheets. perl -pi -e 's,/icon,/awstatsicons,g' wwwroot/css/* # Fix some bad file permissions here for convenience. @@ -43,6 +63,7 @@ find tools/xslt -type f | xargs chmod -x perl -pi -e 's/\r//g' tools/httpd_conf tools/logresolvemerge.pl # SELinux README cp -a %{SOURCE1} README.SELinux +mkdir selinux %install @@ -111,6 +132,15 @@ echo "# Additional Perl modules # Cron job install -m 0755 awstats.cron $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/%{name} +# SELinux support +cd selinux +echo 'policy_module(%{name}, 1.0)' > %{name}.te +echo '%{_datadir}/awstats/wwwroot/cgi-bin(/.*)? system_u:object_r:httpd_sys_script_exec_t:s0' > %{name}.fc +echo '%{_localstatedir}/lib/awstats(/.*)? system_u:object_r:httpd_sys_script_rw_t:s0' >> %{name}.fc +touch %{name}.if +make -f %{_datadir}/selinux/devel/Makefile +install -p -m 644 -D %{name}.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/%{name}.pp + %clean rm -rf $RPM_BUILD_ROOT @@ -125,27 +155,29 @@ if [ $1 -eq 1 ]; then ' > %{_sysconfdir}/%{name}/%{name}.`hostname`.conf || : fi fi -### SELinux support ### -# Set SELinux file_context -semanage fcontext -a -t httpd_sys_script_exec_t \ - '%{_datadir}/awstats/wwwroot/cgi-bin(/.*)?' 2>/dev/null || : -semanage fcontext -a -t httpd_sys_script_rw_t '%{_localstatedir}/lib/awstats(/.*)?' 2>/dev/null || : -# Actually change the context -chcon -R -t httpd_sys_script_exec_t %{_datadir}/awstats/wwwroot/cgi-bin || : -chcon -R -t httpd_sys_script_rw_t %{_localstatedir}/lib/awstats || : - %postun if [ $1 -ne 0 ]; then /sbin/service httpd condrestart >/dev/null 2>&1 fi -# SELinux support -if [ $1 -eq 0 ]; then - semanage fcontext -d -t httpd_sys_script_exec_t \ - '%{_datadir}/awstats/wwwroot/cgi-bin(/.*)?' 2>/dev/null || : - semanage fcontext -d -t httpd_sys_script_rw_t '%{_localstatedir}/lib/awstats(/.*)?' 2>/dev/null || : + +%post selinux +if [ "$1" -le "1" ]; then # Fist install + semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp 2>/dev/null || : + fixfiles -R %{name} restore fi +%preun selinux +if [ "$1" -lt "1" ]; then # Final removal + semodule -r %{name} 2>/dev/null || : + fixfiles -R %{name} restore +fi + +%postun selinux +if [ "$1" -ge "1" ]; then # Upgrade + # Replaces the module if it is already loaded + semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp 2>/dev/null || : +fi %files @@ -161,7 +193,7 @@ fi %{_datadir}/%{name}/wwwroot/cgi-bin # Different defattr to fix lots of files which should not be +x. %defattr(644,root,root,755) -%doc README.TXT docs/* README.SELinux +%doc README.TXT docs/* %{_datadir}/%{name}/lang %{_datadir}/%{name}/lib %{_datadir}/%{name}/plugins @@ -171,8 +203,18 @@ fi %{_datadir}/%{name}/wwwroot/js +%files selinux +%defattr(644, root, root, 755) +%doc README.SELinux +%{_datadir}/selinux/packages/%{name}/%{name}.pp + %changelog +* Mon Aug 13 2007 Aurelien Bompard 6.7-1 +- split SElinux bits in the -selinux package (bug 250637) +- use an SElinux module instead of semanage +- update to version 6.7 + * Sun Jan 07 2007 Aurelien Bompard 6.6-1 - version 6.6 final diff --git a/sources b/sources index b661447..89dc12a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -38e393edb530d409fdf7f79127a7548e awstats-6.6.tar.gz +512cd146247eb178ef023c924f7bb766 awstats-6.7.tar.gz