1N/A#!./perl -T
1N/A
1N/ABEGIN {
1N/A unless(grep /blib/, @INC) {
1N/A chdir 't' if -d 't';
1N/A @INC = '../lib';
1N/A }
1N/A}
1N/A
1N/Ause Config;
1N/A
1N/ABEGIN {
1N/A if(-d "lib" && -f "TEST") {
1N/A if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') {
1N/A print "1..0\n";
1N/A exit 0;
1N/A }
1N/A }
1N/A}
1N/A
1N/AEND { unlink "./__taint__$$" }
1N/A
1N/Aprint "1..3\n";
1N/Ause IO::File;
1N/A$x = new IO::File "> ./__taint__$$" || die("Cannot open ./__taint__$$\n");
1N/Aprint $x "$$\n";
1N/A$x->close;
1N/A
1N/A$x = new IO::File "< ./__taint__$$" || die("Cannot open ./__taint__$$\n");
1N/Achop($unsafe = <$x>);
1N/Aeval { kill 0 * $unsafe };
1N/Aprint "not " if ((($^O ne 'MSWin32') && ($^O ne 'NetWare')) and ($@ !~ /^Insecure/o));
1N/Aprint "ok 1\n";
1N/A$x->close;
1N/A
1N/A# We could have just done a seek on $x, but technically we haven't tested
1N/A# seek yet...
1N/A$x = new IO::File "< ./__taint__$$" || die("Cannot open ./__taint__$$\n");
1N/A$x->untaint;
1N/Aprint "not " if ($?);
1N/Aprint "ok 2\n"; # Calling the method worked
1N/Achop($unsafe = <$x>);
1N/Aeval { kill 0 * $unsafe };
1N/Aprint "not " if ($@ =~ /^Insecure/o);
1N/Aprint "ok 3\n"; # No Insecure message from using the data
1N/A$x->close;
1N/A
1N/Aexit 0;