|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-10 00:44 UTC] priappub at yahoo dot fr
Description: ------------ On solaris 10 (update 3) on sparc with PHP 5.1.6 or 5.1.2, safe mode doesn't work. I have the message: SAFE MODE Restriction in effect. The script whose uid/gid is 1/10076 is not allowed to access /sites/toto.php owned by uid/gid 10076/1000 in Unknown on line 0 The script and the directory have the same UID/GID. It seems like in safe_mode.c, php-getuid() always returns 1 and php_getgid() returns the UID. NB: same bug as http://bugs.php.net/bug.php?id=7744 or http://bugs.php.net/bug.php?id=18500 (they are old and for PHP4) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 06:00:01 2025 UTC |
I can confirm a very similar bug on Solaris 10 SPARC Update 3 with the latest php5.2-200707231430 snapshot. Here is the testing script /tmp/test.php: <?php echo "safe = " . (ini_get('safe_mode') ? "On" : "Off") . "\n"; echo "uid = " . getmyuid() . "\n"; echo "gid = " . getmygid() . "\n"; echo file_get_contents('/etc/passwd'); ?> I have performed these commands in PHP source directory (as root): cd /tmp/php5.2-200707231430 ./configure --disable-all --disable-cgi --enable-safe-mode make I login with a user account (uid:gid 2010:605) cd /tmp/php5.2-200707231430/sapi/cli ./php test.php The output is the following: safe = On uid = 0 gid = 1004 ........ and then the contents of the '/etc/passwd' file. Actually it does not matter which user is executing this script. It always returns uid:gid as 0:1004 (even for a root user). It also does not matter whether 'Safe Mode' is On or Off. This makes 'Safe Mode' practically useless on the machine, as all the scripts run with root's uid. At first I thought that the gid 1004 is coming out of the blue, because I do not have any groups with such id. Then I saw that the files in PHP source tarball as well as the compiled binary in 'sapi/cli' directory have uig:gid 1004:1004. So it would be logical to assume that all of that is somehow related. I tried to change the uid:gid of the compiled binary but it did not change the behaviour. I guess something goes wrong during the compilation phase. I cannot provide access to this machine at the moment, but I could arrange it if really was required. Otherwise I am happy to do any other additional testing that could be useful.