use cleanLDAPResult()

This commit is contained in:
Roland Gruber 2009-12-19 16:07:10 +00:00
parent 23e36ba2cd
commit 9f5570482e
4 changed files with 10 additions and 12 deletions

View File

@ -190,8 +190,11 @@ class ddns extends baseModule {
$search = @ldap_search($ldap,$dn,"dhcpStatements=ddns-update-style interim", array(), 0, 0, 0, LDAP_DEREF_NEVER);
if ($search) {
$info = @ldap_get_entries($ldap,$search);
if ($info && ($info['count'] > 0)) {
return true;
if ($info) {
$info = cleanLDAPResult($info);
if (sizeof($info) > 0) {
return true;
}
}
else {
return false;

View File

@ -827,7 +827,8 @@ class kolabUser extends baseModule {
$sr = @ldap_search($_SESSION['ldapHandle'], escapeDN($this->selfServiceSettings->LDAPSuffix), '(&(objectClass=inetOrgPerson)(mail=*))', array('mail'), 0, 0, 0, LDAP_DEREF_NEVER);
if ($sr) {
$result = ldap_get_entries($_SESSION['ldapHandle'], $sr);
for ($i = 0; $i < $result['count']; $i++) {
$result = cleanLDAPResult($result);
for ($i = 0; $i < sizeof($result); $i++) {
$delegates[] = $result[$i]['mail'][0];
}
}

View File

@ -165,11 +165,8 @@ class lamGroupList extends lamList {
isset($this->primary_hash[$gid]) && is_array($this->primary_hash[$gid]) &&
(sizeof($this->primary_hash[$gid]) > 0));
}
if ($use_primary) {
if (isset($entry[$attribute]) && isset($entry[$attribute]['count'])) unset($entry[$attribute]['count']);
} else {
if (!$use_primary) {
if (!isset($entry[$attribute]) || !is_array($entry[$attribute]) || (sizeof($entry[$attribute]) < 1)) return;
if (isset($entry[$attribute]['count'])) unset($entry[$attribute]['count']);
// sort array
sort($entry[$attribute]);
}
@ -250,8 +247,7 @@ class lamGroupList extends lamList {
if ($sr) {
$members = ldap_get_entries($_SESSION["ldap"]->server(), $sr);
ldap_free_result($sr);
// delete first array entry which is "count"
unset($members['count']);
$members = cleanLDAPResult($members);
for ($j = 0; $j < sizeof($members); $j++) {
$this->primary_hash[$gid][$j] = $members[$j]['uid'][0];
}

View File

@ -170,7 +170,7 @@ class lamUserList extends lamList {
$sr = @ldap_search($_SESSION["ldap"]->server(), escapeDN($grp_suffix), $filter, $attrs, 0, 0, 0, LDAP_DEREF_NEVER);
if ($sr) {
$info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr);
unset($info['count']); // delete count entry
$info = cleanLDAPResult($info);
for ($i = 0; $i < sizeof($info); $i++) {
$this->trans_primary_hash[$info[$i]['gidnumber'][0]] = $info[$i]['cn'][0];
}
@ -186,7 +186,6 @@ class lamUserList extends lamList {
protected function listPrintTableCellContent(&$entry, &$attribute) {
// check if there is something to display at all
if (!isset($entry[$attribute]) || !is_array($entry[$attribute]) || (sizeof($entry[$attribute]) < 1)) return;
if (isset($entry[$attribute]['count'])) unset($entry[$attribute]['count']);
// translate GID to group name
if (($attribute == "gidnumber") && ($this->trans_primary == "on")) {
if (isset($this->trans_primary_hash[$entry[$attribute][0]])) {
@ -205,7 +204,6 @@ class lamUserList extends lamList {
$tempEntry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
if ($tempEntry) {
$binData = ldap_get_values_len($_SESSION['ldap']->server(), $tempEntry, $attribute);
if (isset($binData['count'])) unset($binData['count']);
$entry[$attribute] = $binData;
}
}