Annotation of embedaddon/php/tests/security/open_basedir_copy.phpt, revision 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: test_open_basedir_before("copy");
! 9:
! 10: var_dump(copy("ok.txt", "../bad"));
! 11: var_dump(copy("ok.txt", "../bad/bad.txt"));
! 12: var_dump(copy("ok.txt", ".."));
! 13: var_dump(copy("ok.txt", "../"));
! 14: var_dump(copy("ok.txt", "/"));
! 15: var_dump(copy("ok.txt", "../bad/."));
! 16: var_dump(copy("ok.txt", "../bad/./bad.txt"));
! 17: var_dump(copy("ok.txt", "./../."));
! 18:
! 19: var_dump(copy("ok.txt", "copy.txt"));
! 20: var_dump(unlink("copy.txt"));
! 21: test_open_basedir_after("copy");
! 22: ?>
! 23: --CLEAN--
! 24: <?php
! 25: require_once "open_basedir.inc";
! 26: delete_directories();
! 27: ?>
! 28: --EXPECTF--
! 29: *** Testing open_basedir configuration [copy] ***
! 30: bool(true)
! 31: bool(true)
! 32: bool(true)
! 33: bool(true)
! 34: bool(true)
! 35:
! 36: Warning: copy(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
! 37:
! 38: Warning: copy(../bad): failed to open stream: %s in %s on line %d
! 39: bool(false)
! 40:
! 41: Warning: copy(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
! 42:
! 43: Warning: copy(../bad/bad.txt): failed to open stream: %s in %s on line %d
! 44: bool(false)
! 45:
! 46: Warning: copy(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
! 47:
! 48: Warning: copy(..): failed to open stream: %s in %s on line %d
! 49: bool(false)
! 50:
! 51: Warning: copy(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
! 52:
! 53: Warning: copy(../): failed to open stream: %s in %s on line %d
! 54: bool(false)
! 55:
! 56: Warning: copy(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
! 57:
! 58: Warning: copy(/): failed to open stream: %s in %s on line %d
! 59: bool(false)
! 60:
! 61: Warning: copy(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
! 62:
! 63: Warning: copy(../bad/.): failed to open stream: %s in %s on line %d
! 64: bool(false)
! 65:
! 66: Warning: copy(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
! 67:
! 68: Warning: copy(../bad/./bad.txt): failed to open stream: %s in %s on line %d
! 69: bool(false)
! 70:
! 71: Warning: copy(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
! 72:
! 73: Warning: copy(./../.): failed to open stream: %s in %s on line %d
! 74: bool(false)
! 75: bool(true)
! 76: bool(true)
! 77: *** Finished testing open_basedir configuration [copy] ***
! 78:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>