File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
security /
open_basedir_tempnam.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
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: test_open_basedir_before("tempnam");
10:
11: var_dump(tempnam("../bad", "test"));
12: var_dump(tempnam("..", "test"));
13: var_dump(tempnam("../", "test"));
14: var_dump(tempnam("/", "test"));
15: var_dump(tempnam("../bad/.", "test"));
16: var_dump(tempnam("./../.", "test"));
17: var_dump(tempnam("", "test"));
18:
19: //absolute test
20: $file = tempnam($initdir."/test/ok", "test");
21: var_dump($file);
22: var_dump(unlink($file));
23:
24: //relative test
25: $file = tempnam(".", "test");
26: var_dump($file);
27: var_dump(unlink($file));
28:
29: $file = tempnam("../ok", "test");
30: var_dump($file);
31: var_dump(unlink($file));
32:
33: test_open_basedir_after("tempnam");
34: ?>
35: --CLEAN--
36: <?php
37: require_once "open_basedir.inc";
38: delete_directories();
39: ?>
40: --EXPECTF--
41: *** Testing open_basedir configuration [tempnam] ***
42: bool(true)
43: bool(true)
44: bool(true)
45: bool(true)
46: bool(true)
47:
48: Warning: tempnam(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
49: bool(false)
50:
51: Warning: tempnam(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
52: bool(false)
53:
54: Warning: tempnam(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
55: bool(false)
56:
57: Warning: tempnam(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
58: bool(false)
59:
60: Warning: tempnam(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
61: bool(false)
62:
63: Warning: tempnam(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
64: bool(false)
65:
66: Warning: tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (.) in %s on line %d
67: bool(false)
68: string(%d) "%s"
69: bool(true)
70: string(%d) "%s"
71: bool(true)
72: string(%d) "%s"
73: bool(true)
74: *** Finished testing open_basedir configuration [tempnam] ***
75:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>