Annotation of embedaddon/php/tests/security/open_basedir_chmod.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test open_basedir configuration
3: --INI--
4: open_basedir=.
5: --FILE--
6: <?php
7: require_once "open_basedir.inc";
8: $initdir = getcwd();
9:
10: test_open_basedir_before("chmod");
11:
12: var_dump(chmod("../bad", 0600));
13: var_dump(chmod("../bad/bad.txt", 0600));
14: var_dump(chmod("..", 0600));
15: var_dump(chmod("../", 0600));
16: var_dump(chmod("/", 0600));
17: var_dump(chmod("../bad/.", 0600));
18: var_dump(chmod("../bad/./bad.txt", 0600));
19: var_dump(chmod("./../.", 0600));
20:
21: var_dump(chmod($initdir."/test/ok/ok.txt", 0600));
22: var_dump(chmod("./ok.txt", 0600));
23: var_dump(chmod("ok.txt", 0600));
24: var_dump(chmod("../ok/ok.txt", 0600));
25: var_dump(chmod("../ok/./ok.txt", 0600));
26: chmod($initdir."/test/ok/ok.txt", 0777);
27:
28: test_open_basedir_after("chmod");
29: ?>
30: --CLEAN--
31: <?php
32: require_once "open_basedir.inc";
33: delete_directories();
34: ?>
35: --EXPECTF--
36: *** Testing open_basedir configuration [chmod] ***
37: bool(true)
38: bool(true)
39: bool(true)
40: bool(true)
41: bool(true)
42:
43: Warning: chmod(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
44: bool(false)
45:
46: Warning: chmod(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
47: bool(false)
48:
49: Warning: chmod(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
50: bool(false)
51:
52: Warning: chmod(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
53: bool(false)
54:
55: Warning: chmod(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
56: bool(false)
57:
58: Warning: chmod(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
59: bool(false)
60:
61: Warning: chmod(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
62: bool(false)
63:
64: Warning: chmod(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
65: bool(false)
66: bool(true)
67: bool(true)
68: bool(true)
69: bool(true)
70: bool(true)
71: *** Finished testing open_basedir configuration [chmod] ***
72:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>