diff options
author | Raghubansh Kumar <kraghuba@php.net> | 2007-07-06 03:40:31 +0000 |
---|---|---|
committer | Raghubansh Kumar <kraghuba@php.net> | 2007-07-06 03:40:31 +0000 |
commit | 28b73af90f7a76d9aa06ac2f55838a7260fb1826 (patch) | |
tree | 39387c53b3e18ec6933233eafd9f47158686d916 | |
parent | fd784655a2407ef4a0bb66c47291d730c5791a6c (diff) | |
download | php-git-28b73af90f7a76d9aa06ac2f55838a7260fb1826.tar.gz |
better check for root user
-rw-r--r-- | ext/standard/tests/file/006_basic.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/file/006_variation1.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/file/006_variation2.phpt | 12 |
3 files changed, 30 insertions, 6 deletions
diff --git a/ext/standard/tests/file/006_basic.phpt b/ext/standard/tests/file/006_basic.phpt index f7da0e8c94..b4eee97d37 100644 --- a/ext/standard/tests/file/006_basic.phpt +++ b/ext/standard/tests/file/006_basic.phpt @@ -5,9 +5,17 @@ Test fileperms() & chmod() functions: basic functionality if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip Not on Windows'); } -elseif (get_current_user() == 'root') { - die( "skip Do not run with root permissions" ); +// Skip if being run by root +$filename = dirname(__FILE__)."/006_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); } + +unlink($filename); + ?> --FILE-- <?php diff --git a/ext/standard/tests/file/006_variation1.phpt b/ext/standard/tests/file/006_variation1.phpt index 5418a2d08c..5162181bf7 100644 --- a/ext/standard/tests/file/006_variation1.phpt +++ b/ext/standard/tests/file/006_variation1.phpt @@ -5,9 +5,17 @@ Test fileperms() & chmod() functions: usage variation - perms(0000-0777) if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip Not on Windows'); } -elseif (get_current_user() == 'root') { - die( "skip Do not run with root permissions" ); +// Skip if being run by root +$filename = dirname(__FILE__)."/006_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); } + +unlink($filename); + ?> --FILE-- <?php diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index 024436282d..e224be2b1f 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -5,9 +5,17 @@ Test fileperms() & chmod() functions: usage variation - misc. perms if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip Not on Windows'); } -elseif (get_current_user() == 'root') { - die( "skip Do not run with root permissions" ); +// Skip if being run by root +$filename = dirname(__FILE__)."/006_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); } + +unlink($filename); + ?> --FILE-- <?php |