SOURCES: vlogger-allow-paths.patch - more robust and safe

patrys patrys at pld-linux.org
Fri Nov 24 03:32:01 CET 2006


Author: patrys                       Date: Fri Nov 24 02:32:00 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- more robust and safe

---- Files affected:
SOURCES:
   vlogger-allow-paths.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/vlogger-allow-paths.patch
diff -u SOURCES/vlogger-allow-paths.patch:1.1 SOURCES/vlogger-allow-paths.patch:1.2
--- SOURCES/vlogger-allow-paths.patch:1.1	Fri Nov 24 03:05:12 2006
+++ SOURCES/vlogger-allow-paths.patch	Fri Nov 24 03:31:55 2006
@@ -1,52 +1,65 @@
 --- vlogger~	2006-11-24 02:45:46.366608000 +0100
-+++ vlogger	2006-11-24 02:59:07.076608000 +0100
-@@ -38,7 +38,7 @@
- 
- $ENV{PATH} = "/bin:/usr/bin";
- 
--my $VERSION = "1.3";
-+my $VERSION = "1.3b";
- 
- =head1 NAME
- 
-@@ -114,6 +114,10 @@
++++ vlogger	2006-11-24 03:30:21.466608000 +0100
+@@ -114,6 +114,13 @@
  -v
  	Prints version information.
  
-+-x
-+	Accept potentially unsafe vserver names (useful if you replace
++-x PREFIX
++	Accept potentially unsafe vhost names (useful if you replace
 +%v with %{DOCUMENT_ROOT}e)
 +
++-p PATH
++	Default logfile to use for unmatched vhosts
++
  =head1 DBI USAGE TRACKER
  
  	Vlogger can automatically keep track of per-virtualhost usage statistics in a
-@@ -150,7 +154,7 @@
+@@ -150,7 +157,7 @@
  
  # get command line options
  our %OPTS;
 -getopts( 'f:t:s:hu:g:aeivr:d:', \%OPTS );
-+getopts( 'f:t:s:hu:g:aeivxr:d:', \%OPTS );
++getopts( 'f:t:s:hu:g:aeivp:x:r:d:', \%OPTS );
  
  # print out version
  if ( $OPTS{'v'} ) {
-@@ -378,8 +382,10 @@
+@@ -167,6 +174,10 @@
+     exit;
+ }
+ 
++unless ( $OPTS{'p'} ) {
++    $OPTS{'p'} = "default";
++}
++
+ # log directory
+ my $LOGDIR;
+ if ( $ARGV[0] ) {
+@@ -376,13 +387,15 @@
+         my @this_line = split ( /\s/, $log_line );
+         my ($vhost) = $this_line[0];
          my $reqsize = $this_line[10];
-         $vhost = lc($vhost) || "default";
+-        $vhost = lc($vhost) || "default";
++        $vhost = lc($vhost) || $OPTS{'p'};
          if (( $vhost =~ m#[/\\]# ) || ( $vhost !~ m#[a-zA-Z0-9\-]\.[a-zA-Z0-9\-\.]# )) {
 -	    $vhost = "default"
 -	}
-+            unless ( $OPTS{'x'} ) {
-+                $vhost = "default"
++            unless ( $OPTS{'x'} && ( substr($vhost, 0, length($OPTS{'x'})) eq $OPTS{'x'} )) {
++                $vhost = $OPTS{'p'};
 +            }
 +        }
          $vhost =~ /(.*)/o;
          $vhost = $1;
- 	$vhost = 'default' unless $vhost;
-@@ -549,6 +555,7 @@
+-	$vhost = 'default' unless $vhost;
++	$vhost = $OPTS{'p'} unless $vhost;
+ 
+         if ( $OPTS{'i'} ) {
+             $reqsize = $this_line[1] + $this_line[2];
+@@ -549,6 +562,8 @@
      print "  -r SIZE                     rotate when file reaches SIZE\n";
      print "  -d CONFIG                   use DBI usage tracker (see perldoc vlogger)\n";
      print "  -i                          extract mod_logio instead of filesize\n";
-+    print "  -x                          accept potentially unsafe vhost names\n";
++    print "  -x PREFIX                   accept potentially unsafe vhost names\n";
++    print "  -p PATH                     default logging path for unknown vhosts\n";
      print "  -h                          display this help\n";
      print "  -v                          output version information\n\n";
      print "TEMPLATE may be a filename with Date::Format codes.  The default template\n";
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/vlogger-allow-paths.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list