From bd52d6fa40c0c6d554f46b24c3903cfa52e9634e Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Wed, 27 Mar 2013 08:08:10 -0400
Subject: [PATCH] - Added function posix_getgrnam() to system.inc.php (for systems where the php-process module is missing).

---
 server/plugins-available/shelluser_base_plugin.inc.php |    2 +-
 server/lib/classes/system.inc.php                      |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 148193f..0b5e458 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -598,6 +598,32 @@
 	}
 	
 	/**
+	* Return info about a group by name
+	*
+	*/
+	function posix_getgrnam($group) {
+		if(!function_exists('posix_getgrnam')){
+			$group_datei = $this->server_conf['group_datei'];
+			$cmd = 'grep -m 1 "^'.$group.':" '.$group_datei;
+			exec($cmd, $output, $return_var);
+			if($return_var != 0 || !$output[0]) return false;
+			list($f1, $f2, $f3, $f4) = explode(':', $output[0]);
+			if($f4 != ''){
+				$members = explode(',', $f4);
+			} else {
+				$members = array();
+			}
+			$group_details = array(	'name' => $group,
+									'passwd' => $f2,
+									'members' => $members,
+									'gid' => $f3);
+			return $group_details;	
+		} else {
+			return posix_getgrnam($group);
+		}
+    }
+	
+	/**
 	 * Get all information from a user
 	 *
 	 */
diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index 54bba59..2924d49 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -162,7 +162,7 @@
 					exec($command);
 					$app->log("Executed command: $command ",LOGLEVEL_DEBUG);
 					*/
-					//$groupinfo = posix_getgrnam($data['new']['pgroup']);
+					//$groupinfo = $app->system->posix_getgrnam($data['new']['pgroup']);
 					$app->system->usermod($data['old']['username'],0, $app->system->getgid($data['new']['pgroup']), $data['new']['dir'], $data['new']['shell'], $data['new']['password'], $data['new']['username']);
 					$app->log("Updated shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
 									

--
Gitblit v1.9.1