#!./perl -T
my ($cwd, $cwd_untainted);
BEGIN {
chdir 't' if -d 't';
}
use Config;
BEGIN {
}
}
# Remove insecure directories from PATH
my @path;
{
##
## Match the directory taint tests in mg.c::Perl_magic_setenv()
##
}
}
use Cwd;
my $found;
$found = 0;
my $case = 2;
my $FastFileTests_OK = 0;
sub cleanup {
}
}
}
}
END {
}
sub touch {
}
}
sub wanted_File_Dir {
print "# \$_ => '$_'\n";
s#\.$## if ($^O eq 'VMS' && $_ ne '.');
delete $Expect_File{ $_}
} else {
delete $Expect_File{$_}
}
}
sub wanted_File_Dir_prune {
}
sub simple_wanted {
print "# \$_ => '$_'\n";
}
# Use dir_path() to specify a directory path that's expected for
# $File::Find::dir (%Expect_Dir). Also use it in file operations like
# chdir, rmdir etc.
#
# dir_path() concatenates directory names to form a *relative*
# directory path, independent from the platform it's run on, although
# there are limitations. Don't try to create an absolute path,
# because that may fail on operating systems that have the concept of
# volume names (e.g. Mac OS). As a special case, you can pass it a "."
# operating systems other than Mac OS (actually, Mac OS will ignore
# the ".", if it's the first argument). If there's no second argument,
# this function will return the empty string on Mac OS and the string
# "./" otherwise.
sub dir_path {
my $first_arg = shift @_;
# ignore first argument; return a relative path
# with leading ":" and with trailing ":"
} else { # other OS
# add leading "./"
return $path;
}
} else { # $first_arg ne '.'
return $first_arg unless @_; # return plain filename
}
}
# Use topdir() to specify a directory path that you want to pass to
# above), except that there's no trailing ":" on Mac OS.
sub topdir {
return $path;
}
# Use file_path() to specify a file path that's expected for $_
# (%Expect_File). Also suitable for file operations like unlink etc.
#
# file_path() concatenates directory names (if any) and a filename to
# form a *relative* file path (the last argument is assumed to be a
# file). It's independent from the platform it's run on, although
# there are limitations. As a special case, you can pass it a "." as
# systems other than Mac OS (actually, Mac OS will ignore the ".", if
# it's the first argument). If there's no second argument, this
# function will return the empty string on Mac OS and the string "./"
# otherwise.
sub file_path {
my $first_arg = shift @_;
# ignore first argument; return a relative path
# with leading ":", but without trailing ":"
} else { # other OS
# add leading "./"
return $path;
}
} else { # $first_arg ne '.'
return $first_arg unless @_; # return plain filename
}
}
# Use file_path_name() to specify a file path that's expected for
# $File::Find::Name (%Expect_Name). Note: When the no_chdir => 1
# option is in effect, $_ is the same as $File::Find::Name. In that
# case, also use this function to specify a file path that's expected
# for $_.
#
# Basically, file_path_name() does the same as file_path() (see
# above), except that there's always a leading ":" on Mac OS, even for
sub file_path_name {
return $path;
}
SKIP: {
} else {
}
}
print "# check untainting (no follow)\n";
# untainting here should work correctly
# don't untaint at all, should die
undef $@;
# untaint pattern doesn't match, should die
undef $@;
# untaint pattern doesn't match, should die when we chdir to cwd
print "# check untaint_skip (No follow)\n";
undef $@;
untaint_skip => 1, untaint_pattern =>
print "# $@" if $@;
#$^D = 8;
SKIP: {
print "# --- symbolic link tests --- \n";
print "# check untainting (follow)\n";
# untainting here should work correctly
# no_chdir is in effect, hence we use file_path_name to specify the expected paths for %Expect_File
File::Find::find( {wanted => \&wanted_File_Dir, follow_fast => 1,
no_chdir => 1, untaint => 1, untaint_pattern =>
# don't untaint at all, should die
undef $@;
# untaint pattern doesn't match, should die
undef $@;
untaint => 1, untaint_pattern =>
# untaint pattern doesn't match, should die when we chdir to cwd
print "# check untaint_skip (Follow)\n";
undef $@;
untaint_skip => 1, untaint_pattern =>
}