fixed getgid function

This commit is contained in:
Roland Gruber 2005-06-02 19:11:45 +00:00
parent 50ce4fe6b7
commit ec2328cace
1 changed files with 9 additions and 6 deletions

View File

@ -257,18 +257,21 @@ class cache {
} }
/* This function will return the gidNumber to an existing groupname /**
* gidNumbers are taken from cache-array * This function will return the GID number to an existing group name (using the cache).
*
* @param string $groupname name of group
* @return string GID number
*/ */
function getgid($groupname) { function getgid($groupname) {
$dn_groups = $_SESSION['cache']->get_cache('gidNumber', 'posixGroup', 'group'); $dn_groups = $_SESSION['cache']->get_cache(array('gidNumber', 'cn'), 'posixGroup', 'group');
$DNs = array_keys($dn_groups); $DNs = array_keys($dn_groups);
foreach ($DNs as $DN) { foreach ($DNs as $DN) {
// TODO doesn't work when groupname is part of DN if ($dn_groups[$DN]['cn'][0] == $groupname) {
if (strpos($DN, $groupname)) return $dn_groups[$DN]['gidNumber'][0];
return $dn_groups[$DN][0];
} }
} }
}
/* This function will return an array with all groupnames /* This function will return an array with all groupnames