summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Fuhrmannek2016-03-04 09:51:24 +0100
committerBen Fuhrmannek2016-03-04 09:51:24 +0100
commit1b7ec50b72559b21bd9631b74213a34f9d75e830 (patch)
tree9b17bd160b94224cc287df97f306852a66f66eab
parent64a62f51ba935201599005e5084fc9c13f10fbef (diff)
added open_basedir protection against symlink
-rw-r--r--tests/executor/allow_symlink_off.phpt24
-rw-r--r--tests/executor/allow_symlink_on.phpt22
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/executor/allow_symlink_off.phpt b/tests/executor/allow_symlink_off.phpt
new file mode 100644
index 0000000..8abdee8
--- /dev/null
+++ b/tests/executor/allow_symlink_off.phpt
@@ -0,0 +1,24 @@
1--TEST--
2suhosin.executor.allow_symlink=Off
3--SKIPIF--
4<?php if (!function_exists("memory_get_usage")) print "skip PHP not compiled with memory_limit support"; ?>
5--INI--
6error_reporting=E_ALL
7open_basedir=
8suhosin.log.syslog=0
9suhosin.log.sapi=0
10suhosin.log.script=0
11suhosin.log.file=255
12suhosin.log.file.time=0
13suhosin.log.file.name={PWD}/suhosintest.$$.log.tmp
14auto_append_file={PWD}/suhosintest.$$.log.tmp
15suhosin.executor.allow_symlink=Off
16--FILE--
17<?php
18symlink();
19ini_set("open_basedir", ".");
20symlink();
21?>
22--EXPECTF--
23Warning: symlink() expects exactly 2 parameters, 0 given in %s on line 2
24ALERT - symlink called during open_basedir (attacker 'REMOTE_ADDR not set', file '%s', line 4)
diff --git a/tests/executor/allow_symlink_on.phpt b/tests/executor/allow_symlink_on.phpt
new file mode 100644
index 0000000..dbf902c
--- /dev/null
+++ b/tests/executor/allow_symlink_on.phpt
@@ -0,0 +1,22 @@
1--TEST--
2suhosin.executor.allow_symlink=On
3--SKIPIF--
4<?php if (!function_exists("memory_get_usage")) print "skip PHP not compiled with memory_limit support"; ?>
5--INI--
6error_reporting=E_ALL
7open_basedir=
8suhosin.log.stdout=255
9suhosin.log.script=0
10suhosin.log.syslog=0
11suhosin.log.sapi=0
12suhosin.executor.allow_symlink=On
13--FILE--
14<?php
15symlink();
16ini_set("open_basedir", ".");
17symlink();
18?>
19--EXPECTF--
20Warning: symlink() expects exactly 2 parameters, 0 given in %s on line 2
21
22Warning: symlink() expects exactly 2 parameters, 0 given in %s on line 4