diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-26 13:40:53 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-26 13:40:53 +0000 |
commit | 8852b6d2087faef1097cf525dc7aed28dfc2ece7 (patch) | |
tree | 7988e0b46be313ddb8329838ecc2b801036b5bf3 /t/op/taint.t | |
parent | 0bad50db39116e5a02ec9776c186ce3ee09a9b2d (diff) | |
download | perl-8852b6d2087faef1097cf525dc7aed28dfc2ece7.tar.gz |
Check that all environment variables are tainted.
p4raw-id: //depot/perl@12238
Diffstat (limited to 't/op/taint.t')
-rwxr-xr-x | t/op/taint.t | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/t/op/taint.t b/t/op/taint.t index 592bb2aae5..8ae8202966 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -109,7 +109,7 @@ print PROG 'print "@ARGV\n"', "\n"; close PROG; my $echo = "$Invoke_Perl $ECHO"; -print "1..175\n"; +print "1..176\n"; # First, let's make sure that Perl is checking the dangerous # environment variables. Maybe they aren't set yet, so we'll @@ -121,7 +121,7 @@ print "1..175\n"; delete @ENV{@MoreEnv}; $ENV{TERM} = 'dumb'; - if ($Is_Cygwin) { + if ($Is_Cygwin && ! -f 'cygwin1.dll') { system("/usr/bin/cp /usr/bin/cygwin1.dll .") && die "$0: failed to cp cygwin1.dll: $!\n"; END { unlink "cygwin1.dll" } # yes, done for all platforms... @@ -870,5 +870,18 @@ else { } +{ + # Check that all environment variables are tainted. + my @untainted; + while (my ($k, $v) = each %ENV) { + if (!tainted($v) && + # These we have untainted explicitly earlier. + $k !~ /^(BASH_ENV|CDPATH|ENV|IFS|PATH|TEMP|TERM|TMP)$/) { + push @untainted, "# '$k' = '$v'\n"; + } + } + print @untainted == 0 ? "ok 176\n" : "not ok 176\n"; + print "# untainted:\n", @untainted if @untainted; +} |