use File::Find;
use Cwd;
+# Remove insecure directories from PATH
+my @path;
+my $sep = ($^O eq 'MSWin32') ? ';' : ':';
+foreach my $dir (split(/$sep/,$ENV{'PATH'}))
+ {
+ push(@path,$dir) unless -w $dir;
+ }
+$ENV{'PATH'} = join($sep,@path);
+
cleanup();
if ($^O eq 'MacOS') {
- find({wanted => sub { print "ok 1\n" if $_ eq 'filefind.t'; }, untaint => 1}, ':');
+ find({wanted => sub { print "ok 1\n" if $_ eq 'filefind.t'; }, untaint => 1}, ':');
finddepth({wanted => sub { print "ok 2\n" if $_ eq 'filefind.t'; }, untaint => 1}, ':');
} else {
find({wanted => sub { print "ok 1\n" if $_ eq 'filefind.t'; }, untaint => 1,
untaint_pattern => qr|^(.+)$|}, '.');
- finddepth({wanted => sub { print "ok 2\n" if $_ eq 'filefind.t'; },
+ finddepth({wanted => sub { print "ok 2\n" if $_ eq 'filefind.t'; },
untaint => 1, untaint_pattern => qr|^(.+)$|}, '.');
}
}
sub wanted {
- print "# '$_' => 1\n";
+ print "# '$_' => 1\n";
s#\.$## if ($^O eq 'VMS' && $_ ne '.');
Check( $Expect{$_} );
if ( $FastFileTests_OK ) {
- delete $Expect{$_}
+ delete $Expect{$_}
unless ( $Expect_Dir{$_} && ! -d _ );
} else {
- delete $Expect{$_}
+ delete $Expect{$_}
unless ( $Expect_Dir{$_} && ! -d $_ );
}
$File::Find::prune=1 if $_ eq 'faba';
my $OK = exists($Expect{$n});
unless ($^O eq 'MacOS') {
if ( $OK ) {
- $OK= exists($Expect{substr($n,0,$i)}) if $i >= 0;
+ $OK= exists($Expect{substr($n,0,$i)}) if $i >= 0;
}
}
Check($OK);
%Expect = (':' => 1, 'fsl' => 1, 'fa_ord' => 1, 'fab' => 1, 'fab_ord' => 1,
'faba' => 1, 'faa' => 1, 'faa_ord' => 1);
delete $Expect{'fsl'} unless $symlink_exists;
- %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
+ %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
'fb' => 1, 'fba' => 1);
delete @Expect_Dir{'fb','fba'} unless $symlink_exists;
- File::Find::find( {wanted => \&wanted, untaint => 1},':fa' );
+ File::Find::find( {wanted => \&wanted, untaint => 1},':fa' );
Check( scalar(keys %Expect) == 0 );
%Expect=(':fa' => 1, ':fa:fsl' => 1, ':fa:fa_ord' => 1, ':fa:fab' => 1,
':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1,
':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1);
delete $Expect{':fa:fsl'} unless $symlink_exists;
- %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
':fb' => 1, ':fb:fba' => 1);
delete @Expect_Dir{':fb',':fb:fba'} unless $symlink_exists;
File::Find::find( {wanted => \&wanted, no_chdir => 1, untaint => 1},':fa' );
':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1,
':fb' => 1, ':fb:fba' => 1, ':fb:fba:fba_ord' => 1, ':fb:fb_ord' => 1);
delete $Expect{':fa:fsl'} unless $symlink_exists;
- %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
':fb' => 1, ':fb:fba' => 1);
delete @Expect_Dir{':fb',':fb:fba'} unless $symlink_exists;
File::Find::finddepth( {wanted => \&dn_wanted, untaint => 1 },':' );
':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1,
':fb' => 1, ':fb:fba' => 1, ':fb:fba:fba_ord' => 1, ':fb:fb_ord' => 1);
delete $Expect{':fa:fsl'} unless $symlink_exists;
- %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
':fb' => 1, ':fb:fba' => 1);
delete @Expect_Dir{':fb',':fb:fba'} unless $symlink_exists;
File::Find::finddepth( {wanted => \&d_wanted, no_chdir => 1, untaint => 1 },':' );
undef $@;
eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1,
- untaint_pattern => qr|^(NO_MATCH)$|},':fa' );};
+ untaint_pattern => qr|^(NO_MATCH)$|},':fa' );};
print "# Died: $@";
Check( $@ =~ m|is still tainted| );
chdir($cwd_untainted);
print "# check untaint_skip (no follow)\n";
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
+ eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
untaint_pattern => qr|^(NO_MATCH)$|}, ':fa' );};
print "# Died: $@";
Check( $@ =~ m|insecure cwd| );
print "# check preprocess\n";
%Expect=(
- ':' => {fa => 1, fb => 1},
+ ':' => {fa => 1, fb => 1},
':fa:' => {faa => 1, fab => 1, fa_ord => 1},
':fa:faa:' => {faa_ord => 1},
':fa:fab:' => {faba => 1, fab_ord => 1},
- ':fa:fab:faba:' => {faba_ord => 1},
+ ':fa:fab:faba:' => {faba_ord => 1},
':fb:' => {fba => 1, fb_ord => 1},
':fb:fba:' => {fba_ord => 1}
);
%Expect=(':' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1,
'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faa' => 1,
'faa_ord' => 1);
- %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
- 'fb' => 1, 'fba' => 1);
+ %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
+ 'fb' => 1, 'fba' => 1);
File::Find::find( {wanted => \&wanted, follow_fast => 1, untaint => 1},':fa' );
- Check( scalar(keys %Expect) == 0 );
+ Check( scalar(keys %Expect) == 0 );
%Expect=(':fa' => 1, ':fa:fa_ord' => 1, ':fa:fsl' => 1, ':fa:fsl:fb_ord' => 1,
':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1,
':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1,
':fa:faa' => 1, ':fa:faa:faa_ord' => 1);
- %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
- ':fb' => 1, ':fb:fba' => 1);
+ %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ ':fb' => 1, ':fb:fba' => 1);
File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1, untaint => 1 },':fa' );
Check( scalar(keys %Expect) == 0 );
':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1,
':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1,
':fa:faa' => 1, ':fa:faa:faa_ord' => 1);
- %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
':fb' => 1, ':fb:fba' => 1);
File::Find::finddepth( {wanted => \&dn_wanted, follow_fast => 1, untaint => 1 },':fa' );
Check( scalar(keys %Expect) == 0 );
':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1,
':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1,
':fa:faa' => 1, ':fa:faa:faa_ord' => 1);
- %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
':fb' => 1, ':fb:fba' => 1);
File::Find::finddepth( {wanted => \&d_wanted, follow_fast => 1, no_chdir => 1, untaint => 1 },':fa' );
- Check( scalar(keys %Expect) == 0 );
+ Check( scalar(keys %Expect) == 0 );
# tests below added by Thomas Wegner, 17-05-2001
%Expect=(':' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1,
'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faba_ord' => 1,
'faa' => 1, 'faa_ord' => 1);
- %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
+ %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
'fb' => 1, 'fba' => 1);
undef $warn_msg;
File::Find::find( {wanted => \&d_wanted, follow => 1, untaint => 1 }, 'dangling_dir_sl', ':fa' );
- Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| );
+ Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| );
unlink ':fa:dangling_file_sl', 'dangling_dir_sl';
print "# check recursion\n";
undef $@;
eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1, untaint => 1 },':fa' ); };
print "# Died: $@";
- Check( $@ =~ m|:for_find:fa:faa:faa_sl is a recursive symbolic link| );
- unlink ':fa:faa:faa_sl';
+ Check( $@ =~ m|:for_find:fa:faa:faa_sl is a recursive symbolic link| );
+ unlink ':fa:faa:faa_sl';
print "# check follow_skip (file)\n";
CheckDie( symlink(':fa:fa_ord',':fa:fa_ord_sl') ); # symlink to a file
undef $@;
- eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1,follow_skip => 0,
+ eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1,follow_skip => 0,
no_chdir => 1, untaint => 1 },':fa' );};
print "# Died: $@";
Check( $@ =~ m|:for_find:fa:fa_ord encountered a second time| );
':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1,
':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1,
':fa:faa' => 1, ':fa:faa:faa_ord' => 1);
- %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
- ':fb' => 1, ':fb:fba' => 1);
+ %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ ':fb' => 1, ':fb:fba' => 1);
File::Find::finddepth( {wanted => \&wanted, follow => 1, follow_skip => 1, no_chdir => 1,
untaint => 1 },':fa' );
Check( scalar(keys %Expect) == 0 );
print "# check follow_skip (directory)\n";
CheckDie( symlink(':fa:faa',':fa:faa_sl') ); # symlink to a directory
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 0,
+ eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 0,
no_chdir => 1, untaint => 1 },':fa' );};
print "# Died: $@";
Check( $@ =~ m|:for_find:fa:faa: encountered a second time| );
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 1,
+ eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 1,
no_chdir => 1, untaint => 1 },':fa' );};
print "# Died: $@";
- Check( $@ =~ m|:for_find:fa:faa: encountered a second time| );
+ Check( $@ =~ m|:for_find:fa:faa: encountered a second time| );
%Expect=(':fa' => 1, ':fa:fa_ord' => 1, ':fa:fsl' => 1, ':fa:fsl:fb_ord' => 1,
':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1,
':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1,
':fa:faa' => 1, ':fa:faa:faa_ord' => 1);
- %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
- ':fb' => 1, ':fb:fba' => 1);
- File::Find::find( {wanted => \&wanted, follow => 1, follow_skip => 2, no_chdir => 1,
+ %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1,
+ ':fb' => 1, ':fb:fba' => 1);
+ File::Find::find( {wanted => \&wanted, follow => 1, follow_skip => 2, no_chdir => 1,
untaint => 1},':fa' );
Check( scalar(keys %Expect) == 0 );
unlink ':fa:faa_sl';
Check( $@ =~ m|Insecure dependency| );
chdir($cwd_untainted);
- undef $@;
+ undef $@;
eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, untaint => 1,
untaint_pattern => qr|^(NO_MATCH)$|},':fa' );};
print "# Died: $@";
print "# check untaint_skip (follow)\n";
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
+ eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
untaint_pattern => qr|^(NO_MATCH)$|}, ':fa' );};
print "# Died: $@";
Check( $@ =~ m|insecure cwd| );
%Expect = ('.' => 1, 'fsl' => 1, 'fa_ord' => 1, 'fab' => 1, 'fab_ord' => 1,
'faba' => 1, 'faa' => 1, 'faa_ord' => 1);
delete $Expect{'fsl'} unless $symlink_exists;
- %Expect_Dir = ('fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
+ %Expect_Dir = ('fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1,
'fb' => 1, 'fba' => 1);
delete @Expect_Dir{'fb','fba'} unless $symlink_exists;
File::Find::find( {wanted => \&wanted, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );
'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1,
'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1);
delete $Expect{'fa/fsl'} unless $symlink_exists;
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
'fb' => 1, 'fb/fba' => 1);
delete @Expect_Dir{'fb','fb/fba'} unless $symlink_exists;
File::Find::find( {wanted => \&wanted, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );
'./fa/fab/faba/faba_ord' => 1, './fa/faa' => 1, './fa/faa/faa_ord' => 1,
'./fb' => 1, './fb/fba' => 1, './fb/fba/fba_ord' => 1, './fb/fb_ord' => 1);
delete $Expect{'./fa/fsl'} unless $symlink_exists;
- %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1,
+ %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1,
'./fb' => 1, './fb/fba' => 1);
delete @Expect_Dir{'./fb','./fb/fba'} unless $symlink_exists;
File::Find::finddepth( {wanted => \&dn_wanted , untaint => 1, untaint_pattern => qr|^(.+)$|},'.' );
'./fa/fab/faba/faba_ord' => 1, './fa/faa' => 1, './fa/faa/faa_ord' => 1,
'./fb' => 1, './fb/fba' => 1, './fb/fba/fba_ord' => 1, './fb/fb_ord' => 1);
delete $Expect{'./fa/fsl'} unless $symlink_exists;
- %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1,
+ %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1,
'./fb' => 1, './fb/fba' => 1);
delete @Expect_Dir{'./fb','./fb/fba'} unless $symlink_exists;
File::Find::finddepth( {wanted => \&d_wanted, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$| },'.' );
undef $@;
eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1,
- untaint_pattern => qr|^(NO_MATCH)$|},'fa' );};
+ untaint_pattern => qr|^(NO_MATCH)$|},'fa' );};
print "# Died: $@";
Check( $@ =~ m|is still tainted| );
chdir($cwd_untainted);
print "# check untaint_skip (no follow)\n";
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
+ eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
untaint_pattern => qr|^(NO_MATCH)$|}, 'fa' );};
print "# Died: $@";
Check( $@ =~ m|insecure cwd| );
print "# check preprocess\n";
%Expect=(
- '.' => {fa => 1, fb => 1},
+ '.' => {fa => 1, fb => 1},
'./fa' => {faa => 1, fab => 1, fa_ord => 1},
'./fa/faa' => {faa_ord => 1},
'./fa/fab' => {faba => 1, fab_ord => 1},
- './fa/fab/faba' => {faba_ord => 1},
+ './fa/fab/faba' => {faba_ord => 1},
'./fb' => {fba => 1, fb_ord => 1},
'./fb/fba' => {fba_ord => 1}
);
- File::Find::find( {wanted => \&noop_wanted, preprocess => \&my_preprocess, untaint => 1,
+ File::Find::find( {wanted => \&noop_wanted, preprocess => \&my_preprocess, untaint => 1,
untaint_pattern => qr|^(.+)$|}, '.' );
Check( scalar(keys %Expect) == 0 );
print "# check postprocess\n";
%Expect=('.' => 1, './fa' => 1, './fa/faa' => 1, './fa/fab' => 1, './fa/fab/faba' => 1, './fb' => 1,
'./fb/fba' => 1 );
- File::Find::find( {wanted => \&noop_wanted, postprocess => \&my_postprocess, untaint => 1,
+ File::Find::find( {wanted => \&noop_wanted, postprocess => \&my_postprocess, untaint => 1,
untaint_pattern => qr|^(.+)$|}, '.' );
Check( scalar(keys %Expect) == 0 );
%Expect=('.' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1,
'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faa' => 1,
'faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
'fb' => 1, 'fb/fba' => 1);
File::Find::find( {wanted => \&wanted, follow_fast => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );
Check( scalar(keys %Expect) == 0 );
'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1,
'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1,
'fa/faa' => 1, 'fa/faa/faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
'fb' => 1, 'fb/fba' => 1);
- File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1, untaint => 1,
+ File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1, untaint => 1,
untaint_pattern => qr|^(.+)$|},'fa' );
Check( scalar(keys %Expect) == 0 );
'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1,
'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1,
'fa/faa' => 1, 'fa/faa/faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
- 'fb' => 1, 'fb/fba' => 1);
- File::Find::finddepth( {wanted => \&dn_wanted, follow_fast => 1, untaint => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ 'fb' => 1, 'fb/fba' => 1);
+ File::Find::finddepth( {wanted => \&dn_wanted, follow_fast => 1, untaint => 1,
untaint_pattern => qr|^(.+)$|},'fa' );
Check( scalar(keys %Expect) == 0 );
'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1,
'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1,
'fa/faa' => 1, 'fa/faa/faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
'fb' => 1, 'fb/fba' => 1);
- File::Find::finddepth( {wanted => \&d_wanted, follow_fast => 1, no_chdir => 1,
+ File::Find::finddepth( {wanted => \&d_wanted, follow_fast => 1, no_chdir => 1,
untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );
Check( scalar(keys %Expect) == 0 );
%Expect=('.' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1,
'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faba_ord' => 1,
'faa' => 1, 'faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, 'fa/fab' => 1, 'fa/fab/faba' => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, 'fa/fab' => 1, 'fa/fab/faba' => 1,
'fb' => 1, 'fb/fba' => 1);
undef $warn_msg;
- File::Find::find( {wanted => \&d_wanted, follow => 1, untaint => 1,
+ File::Find::find( {wanted => \&d_wanted, follow => 1, untaint => 1,
untaint_pattern => qr|^(.+)$|}, 'dangling_dir_sl', 'fa' );
- Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| );
+ Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| );
unlink 'fa/dangling_file_sl', 'dangling_dir_sl';
print "# check recursion\n";
CheckDie( symlink('../faa','fa/faa/faa_sl') );
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1,
+ eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1,
untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); };
print "# Died: $@";
- Check( $@ =~ m|for_find/fa/faa/faa_sl is a recursive symbolic link| );
- unlink 'fa/faa/faa_sl';
-
+ Check( $@ =~ m|for_find/fa/faa/faa_sl is a recursive symbolic link| );
+ unlink 'fa/faa/faa_sl';
+
print "# check follow_skip (file)\n";
CheckDie( symlink('./fa_ord','fa/fa_ord_sl') ); # symlink to a file
undef $@;
- eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, no_chdir => 1,
+ eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, no_chdir => 1,
untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );};
print "# Died: $@";
Check( $@ =~ m|for_find/fa/fa_ord encountered a second time| );
-
+
%Expect=('fa' => 1, 'fa/fa_ord' => 1, 'fa/fsl' => 1, 'fa/fsl/fb_ord' => 1,
'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1,
'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1,
'fa/faa' => 1, 'fa/faa/faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
- 'fb' => 1, 'fb/fba' => 1);
- File::Find::finddepth( {wanted => \&wanted, follow => 1, follow_skip => 1, no_chdir => 1,
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ 'fb' => 1, 'fb/fba' => 1);
+ File::Find::finddepth( {wanted => \&wanted, follow => 1, follow_skip => 1, no_chdir => 1,
untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );
Check( scalar(keys %Expect) == 0 );
unlink 'fa/fa_ord_sl';
'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1,
'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1,
'fa/faa' => 1, 'fa/faa/faa_ord' => 1);
- %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
- 'fb' => 1, 'fb/fba' => 1);
+ %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1,
+ 'fb' => 1, 'fb/fba' => 1);
File::Find::find( {wanted => \&wanted, follow => 1, follow_skip => 2, no_chdir => 1,
untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );
Check( scalar(keys %Expect) == 0 );
Check( $@ =~ m|Insecure dependency| );
chdir($cwd_untainted);
- undef $@;
+ undef $@;
eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, untaint => 1,
untaint_pattern => qr|^(NO_MATCH)$|},'fa' );};
print "# Died: $@";
print "# check untaint_skip (follow)\n";
undef $@;
- eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
+ eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1,
untaint_pattern => qr|^(NO_MATCH)$|}, 'fa' );};
print "# Died: $@";
Check( $@ =~ m|insecure cwd| );