]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 470442: Only delete tainted environment variables if we're running in taint mode
authormkanat%bugzilla.org <>
Mon, 22 Dec 2008 15:50:50 +0000 (15:50 +0000)
committermkanat%bugzilla.org <>
Mon, 22 Dec 2008 15:50:50 +0000 (15:50 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit

Bugzilla.pm
checksetup.pl
testserver.pl

index 354d051481936b8c8bacdb0b0362629ab0fd9e45..00740682c05642a5ed0a72c5c2df8b6296165f00 100644 (file)
@@ -83,11 +83,14 @@ use constant SHUTDOWNHTML_EXIT_SILENTLY => [
 sub init_page {
     (binmode STDOUT, ':utf8') if Bugzilla->params->{'utf8'};
 
-    # Some environment variables are not taint safe
-    delete @::ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
-    # Some modules throw undefined errors (notably File::Spec::Win32) if
-    # PATH is undefined.
-    $ENV{'PATH'} = '';
+
+    if (${^TAINT}) {
+        # Some environment variables are not taint safe
+        delete @::ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
+        # Some modules throw undefined errors (notably File::Spec::Win32) if
+        # PATH is undefined.
+        $ENV{'PATH'} = '';
+    }
 
     # IIS prints out warnings to the webpage, so ignore them, or log them
     # to a file if the file exists.
index 74b21dfdac1a62bb7c4c3b2f746e2f84a93ce836..da368a822cc7db06baac87c92731adb8e765c65a 100755 (executable)
@@ -95,10 +95,7 @@ exit if $switch{'check-modules'};
 # then instead of our nice normal checksetup message, the user would
 # get a cryptic perl error about the missing module.
 
-# We need $::ENV{'PATH'} to remain defined.
-my $env = $::ENV{'PATH'};
 require Bugzilla;
-$::ENV{'PATH'} = $env;
 
 require Bugzilla::Config;
 import Bugzilla::Config qw(:admin);
index 9b649277caa21a5fd196d413206a4429ee8c3fe9..d3cab1dc5538fe1bc6b79df98e6aa912a618a2b7 100755 (executable)
 use strict;
 use lib qw(. lib);
 
-BEGIN {
-    my $envpath = $ENV{'PATH'};
-    require Bugzilla;
-    # $ENV{'PATH'} is required by the 'ps' command to run correctly.
-    $ENV{'PATH'} = $envpath;
-}
-
+use Bugzilla;
 use Bugzilla::Constants;
 
 use Socket;