Skip to content

Instantly share code, notes, and snippets.

@joar
Created October 11, 2011 19:30
Show Gist options
  • Save joar/1279142 to your computer and use it in GitHub Desktop.
Save joar/1279142 to your computer and use it in GitHub Desktop.
From 0d112b9076c71aa223a60f0faa8d63b1ae9dab18 Mon Sep 17 00:00:00 2001
From: Joar Wandborg <[email protected]>
Date: Tue, 11 Oct 2011 21:26:35 +0200
Subject: [PATCH] Fixed a bug in checkWebserverUser where it would return the owner of the document root instead of the owner of the web server process.
---
lib/util.php | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/util.php b/lib/util.php
index 4920d13..0f8cc08 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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');
--
1.7.4.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment