File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / security / open_basedir_chmod.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: 
   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>