It looks like it is a bug and an old one which has reappeared.

http://bugs.php.net/bug.php?id=18500 Safe mode: php reports wrong uid on 
file

I have test Coolstack 1.3.1 on Solaris 10 and the default apache2/2.2 on 
SXCE snv_101 and they both show the same bug.

# cat > cat test1.php
<html> <head> <title>PHP Test</title> </head>
  <body>
  <br>
<?php
echo "safe = " . (ini_get('safe_mode') ? "On" : "Off") . "\n";
echo "uid = " . getmyuid() . "\n";
echo "gid = " . getmygid() . "\n";
echo file_get_contents('/etc/passwd');
?>
  </body>
</html>
^D

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get /test1.php
safe = Off
uid = 1
gid = 0

# id webservd
uid=80(webservd) gid=80(webservd)

# id daemon
uid=1(daemon) gid=1(other)


Andrew


Andrew Watkins wrote:
> I am sure the permissions have not changed, but looking at it more closely it 
> says "uid is 1 is not allowed to access" the file.
> 
> # id daemon
> uid=1(daemon) gid=1(other)
> id webservd
> uid=80(webservd) gid=80(dba)
> 
> "uid=1 is the daemon username, but where it is coming from? Webserver is 
> running as "webservd" 
> 
> Has anyone using 1.3.1 in safe mode?
> 
> # ls -ld index.php .
> drwxr-xr-x   3 webservd root         512 Nov  4 13:14 .
> -rw-r--r--    1 webservd www          101 Oct 31 13:57 index.php
> 
> # ps -ef|grep http
> webservd  6017     1   0 13:12:05 ?           0:01 
> /opt/coolstack/apache2/bin/httpd -k start
> webservd  6019  6017   0 13:12:07 ?           0:00 
> /opt/coolstack/apache2/bin/httpd -k start
> webservd  6020  6017   0 13:12:07 ?           0:00 
> /opt/coolstack/apache2/bin/httpd -k start
> webservd  6021  6017   0 13:12:07 ?           0:00 
> /opt/coolstack/apache2/bin/httpd -k start
> webservd  6022  6017   0 13:12:07 ?           0:00 
> /opt/coolstack/apache2/bin/httpd -k start
> webservd  6018  6017   0 13:12:07 ?           0:00 
> /opt/coolstack/apache2/bin/httpd -k start
> webservd  6029  6017   0 13:12:11 ?           0:00 
> /opt/coolstack/apache2/bin/httpd -k start
> 
> Andrew

-- 
Andrew Watkins * Birkbeck College
http://notallmicrosoft.blogspot.com/

Reply via email to