File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_touch.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, 4 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("touch");
   10: 
   11: var_dump(touch("../bad"));
   12: var_dump(touch("../bad/bad.txt"));
   13: var_dump(touch(".."));
   14: var_dump(touch("../"));
   15: var_dump(touch("/"));
   16: var_dump(touch("../bad/."));
   17: var_dump(touch("../bad/./bad.txt"));
   18: var_dump(touch("./../."));
   19: 
   20: var_dump(touch($initdir."/test/ok/ok.txt"));
   21: var_dump(touch("./ok.txt"));
   22: var_dump(touch("ok.txt"));
   23: var_dump(touch("../ok/ok.txt"));
   24: var_dump(touch("../ok/./ok.txt"));
   25: 
   26: test_open_basedir_after("touch");
   27: ?>
   28: --CLEAN--
   29: <?php
   30: require_once "open_basedir.inc";
   31: delete_directories();
   32: ?>
   33: --EXPECTF--
   34: *** Testing open_basedir configuration [touch] ***
   35: bool(true)
   36: bool(true)
   37: bool(true)
   38: bool(true)
   39: bool(true)
   40: 
   41: Warning: touch(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
   42: bool(false)
   43: 
   44: Warning: touch(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
   45: bool(false)
   46: 
   47: Warning: touch(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
   48: bool(false)
   49: 
   50: Warning: touch(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
   51: bool(false)
   52: 
   53: Warning: touch(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
   54: bool(false)
   55: 
   56: Warning: touch(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
   57: bool(false)
   58: 
   59: Warning: touch(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
   60: bool(false)
   61: 
   62: Warning: touch(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
   63: bool(false)
   64: bool(true)
   65: bool(true)
   66: bool(true)
   67: bool(true)
   68: bool(true)
   69: *** Finished testing open_basedir configuration [touch] ***
   70: 

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