File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_linkinfo.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:34 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

    1: --TEST--
    2: Test open_basedir configuration
    3: --SKIPIF--
    4: <?php
    5: if (substr(PHP_OS, 0, 3) == 'WIN') {
    6:     die('skip no symlinks on Windows');
    7: }
    8: ?>
    9: --XFAIL--
   10: BUG: open_basedir cannot delete symlink to prohibited file. See also
   11: bugs 48111 and 52176.
   12: --FILE--
   13: <?php
   14: chdir(__DIR__);
   15: ini_set("open_basedir", ".");
   16: require_once "open_basedir.inc";
   17: $initdir = getcwd();
   18: test_open_basedir_before("linkinfo", FALSE);
   19: 
   20: chdir($initdir);
   21: 
   22: $target = ($initdir."/test/bad/bad.txt");
   23: $symlink = ($initdir."/test/ok/symlink.txt");
   24: var_dump(symlink($target, $symlink));
   25: 
   26: chdir($initdir."/test/ok");
   27: 
   28: var_dump(linkinfo("symlink.txt"));
   29: var_dump(linkinfo("../ok/symlink.txt"));
   30: var_dump(linkinfo("../ok/./symlink.txt"));
   31: var_dump(linkinfo("./symlink.txt"));
   32: var_dump(linkinfo($initdir."/test/ok/symlink.txt"));
   33: 
   34: $target = ($initdir."/test/ok/ok.txt");
   35: $symlink = ($initdir."/test/ok/symlink.txt");
   36: var_dump(symlink($target, $symlink));
   37: var_dump(linkinfo($symlink));
   38: var_dump(unlink($symlink));
   39: 
   40: test_open_basedir_after("linkinfo");
   41: ?>
   42: --CLEAN--
   43: <?php
   44: require_once "open_basedir.inc";
   45: delete_directories();
   46: ?>
   47: --EXPECTF--
   48: *** Testing open_basedir configuration [linkinfo] ***
   49: bool(true)
   50: bool(true)
   51: bool(true)
   52: bool(true)
   53: bool(true)
   54: int(%d)
   55: int(%d)
   56: int(%d)
   57: int(%d)
   58: int(%d)
   59: 
   60: Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   61: bool(false)
   62: int(%d)
   63: bool(true)
   64: *** Finished testing open_basedir configuration [linkinfo] ***
   65: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>