Put info about the user/group of the web server in the configtest. Grabbing that...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 4 Dec 2008 09:35:41 +0000 (09:35 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 4 Dec 2008 09:35:41 +0000 (09:35 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13346 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/global.php
src/configtest.php

index acfa06253b8cc3689741b14e6c698591de0f151a..aaf06389a90993594aec5c9006afc6d4a8b41e07 100644 (file)
@@ -769,3 +769,48 @@ function is_ssl_secured_connection()
 }
 
 
+/**
+ * Endeavor to detect what user and group PHP is currently
+ * running as.  Probably only works in non-Windows environments.
+ *
+ * @return mixed Boolean FALSE is returned if something went wrong,
+ *               otherwise an array is returned with the following
+ *               elements:
+ *                  uid    The current process' UID (integer)
+ *                  euid   The current process' effective UID (integer)
+ *                  gid    The current process' GID (integer)
+ *                  egid   The current process' effective GID (integer)
+ *                  name   The current process' name/handle (string)
+ *                  ename  The current process' effective name/handle (string)
+ *                  group  The current process' group name (string)
+ *                  egroup The current process' effective group name (string)
+ *               Note that some of these elements may have empty
+ *               values, especially if they could not be determined.
+ *
+ * @since 1.5.2
+ *
+ */
+function get_process_owner_info()
+{
+    if (!function_exists('posix_getuid'))
+        return FALSE;
+
+    $process_info['uid'] = posix_getuid();
+    $process_info['euid'] = posix_geteuid();
+    $process_info['gid'] = posix_getgid();
+    $process_info['egid'] = posix_getegid();
+
+    $user_info = posix_getpwuid($process_info['uid']);
+    $euser_info = posix_getpwuid($process_info['euid']);
+    $group_info = posix_getgrgid($process_info['gid']);
+    $egroup_info = posix_getgrgid($process_info['egid']);
+
+    $process_info['name'] = $user_info['name'];
+    $process_info['ename'] = $euser_info['name'];
+    $process_info['group'] = $user_info['name'];
+    $process_info['egroup'] = $euser_info['name'];
+    
+    return $process_info;
+}
+
+
index 0eaa11407093072010f194e7549336076720bd30..dcb22e5b9af0b3a0ca9cf14fb4a9305c9f0bc426 100644 (file)
@@ -320,6 +320,17 @@ if (ini_get('short_open_tag') == 0) {
     do_err($short_open_tag_warning, false);
 }
 
+
+/* check who the web server is running as if possible */
+
+if ($process_info = get_process_owner_info()) {
+    echo $IND . 'Web server is running as user: ' . $process_info['name'] . ' (' . $process_info['uid'] . ")<br />\n";
+    //echo $IND . 'Web server is running as effective user: ' . $process_info['ename'] . ' (' . $process_info['euid'] . ")<br />\n";
+    echo $IND . 'Web server is running as group: ' . $process_info['group'] . ' (' . $process_info['gid'] . ")<br />\n";
+    //echo $IND . 'Web server is running as effective group: ' . $process_info['egroup'] . ' (' . $process_info['egid'] . ")<br />\n";
+}
+
+
 /* checking paths */
 
 echo "Checking paths...<br />\n";