Imported Upstream version 2.5.11
[libapache-mod-security.git] / apache2 / t / tfn / normalisePath.t
1 ### Empty
2 {
3         type => "tfn",
4         name => "normalisePath",
5         input => "",
6         output => "",
7         ret => 0,
8 },
9
10 ### Nothing
11 {
12         type => "tfn",
13         name => "normalisePath",
14         input => "/foo/bar/baz",
15         output => "/foo/bar/baz",
16         ret => 0,
17 },
18 {
19         type => "tfn",
20         name => "normalisePath",
21         input => "/foo/bar\0/baz",
22         output => "/foo/bar\0/baz",
23         ret => 0,
24 },
25
26 ### Basic
27 {
28         type => "tfn",
29         name => "normalisePath",
30         input => "/foo/bar//baz",
31         output => "/foo/bar/baz",
32         ret => 1,
33 },
34 {
35         type => "tfn",
36         name => "normalisePath",
37         input => "/foo/bar baz/././././boo//eek/././../whoa",
38         output => "/foo/bar baz/boo/whoa",
39         ret => 1,
40 },
41 {
42         type => "tfn",
43         name => "normalisePath",
44         input => "./foo/bar baz/././././boo//eek/././../whoa",
45         output => "./foo/bar baz/boo/whoa",
46         ret => 1,
47 },
48 {
49         type => "tfn",
50         name => "normalisePath",
51         input => "/./foo/bar baz/././././boo//eek/././../whoa",
52         output => "/foo/bar baz/boo/whoa",
53         ret => 1,
54 },
55 {
56         type => "tfn",
57         name => "normalisePath",
58         input => "//foo/bar baz/././././boo//eek/././../whoa",
59         output => "/foo/bar baz/boo/whoa",
60         ret => 1,
61 },
62 {
63         type => "tfn",
64         name => "normalisePath",
65         input => "//foo/bar baz/././././boo//eek/././../whoa/./",
66         output => "/foo/bar baz/boo/whoa/",
67         ret => 1,
68 },
69 {
70         type => "tfn",
71         name => "normalisePath",
72         input => "/./foo/bar baz/././././boo//eek/././../whoa//",
73         output => "/foo/bar baz/boo/whoa/",
74         ret => 1,
75 },
76 {
77         type => "tfn",
78         name => "normalisePath",
79         input => "/./../../../../../../../../etc/passwd",
80         output => "/etc/passwd",
81         ret => 1,
82 },
83 {
84         type => "tfn",
85         name => "normalisePath",
86         input => "/./.././../../../../../../../etc/../etc/./passwd",
87         output => "/etc/passwd",
88         ret => 1,
89 },
90
91 ### With NUL
92 {
93         type => "tfn",
94         name => "normalisePath",
95         input => "/./.././../../../../../../../\0/../etc/./passwd",
96         output => "/etc/passwd",
97         ret => 1,
98 },