Fixed a bug in checkWebserverUser

checkWebserverUser would return the owner of the document
root instead of the owner of the web server process.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
This commit is contained in:
Joar Wandborg 2011-10-11 21:26:35 +02:00 committed by Florian Pritz
parent 6163351ea2
commit 9d3c7badb5
1 changed files with 2 additions and 3 deletions

View File

@ -271,9 +271,8 @@ class OC_Util {
* Try to get the username the httpd server runs on, used in hints
*/
public static function checkWebserverUser(){
$stat=stat($_SERVER['DOCUMENT_ROOT']);
if(is_callable('posix_getpwuid')){
$serverUser=posix_getpwuid($stat['uid']);
if(is_callable('posix_getuid')){
$serverUser=posix_getpwuid(posix_getuid());
$serverUser='\''.$serverUser['name'].'\'';
}elseif(exec('whoami')){
$serverUser=exec('whoami');