xref: /openbsd/gnu/usr.bin/perl/t/lib/warnings/taint (revision 3bef86f7)
1  taint.c AOK
2
3  Insecure %s%s while running with -T switch
4
5__END__
6-T
7--FILE-- abc
8def
9--FILE--
10# taint.c
11use Config;
12BEGIN {
13    if ( exists($Config{taint_support}) && not $Config{taint_support}) {
14	print "SKIPPED\n# your perl was built without taint support\n";
15	exit 0;
16    }
17}
18open(FH, "<abc") ;
19$a = <FH> ;
20close FH ;
21chdir $a ;
22print "xxx\n" ;
23EXPECT
24Insecure dependency in chdir while running with -T switch at - line 12.
25########
26-TU
27--FILE-- abc
28def
29--FILE--
30# taint.c
31use Config;
32BEGIN {
33    if ( exists($Config{taint_support}) && not $Config{taint_support}) {
34	print "SKIPPED\n# your perl was built without taint support\n";
35	exit 0;
36    }
37}
38open(FH, "<abc") ;
39$a = <FH> ;
40close FH ;
41chdir $a;
42no warnings 'taint' ;
43chdir $a ;
44print "xxx\n" ;
45use warnings 'taint' ;
46chdir $a ;
47print "yyy\n" ;
48EXPECT
49Insecure dependency in chdir while running with -T switch at - line 12.
50Insecure dependency in chdir while running with -T switch at - line 17.
51xxx
52yyy
53########
54-t
55--FILE-- abc
56def
57--FILE--
58# taint.c
59use Config;
60BEGIN {
61    if ( exists($Config{taint_support}) && not $Config{taint_support}) {
62	print "SKIPPED\n# your perl was built without taint support\n";
63	exit 0;
64    }
65}
66open(FH, "<abc") ;
67$a = <FH> ;
68close FH ;
69chdir $a;
70no warnings 'taint' ;
71chdir $a ;
72print "xxx\n" ;
73use warnings 'taint' ;
74chdir $a ;
75print "yyy\n" ;
76EXPECT
77Insecure dependency in chdir while running with -t switch at - line 12.
78Insecure dependency in chdir while running with -t switch at - line 17.
79xxx
80yyy
81