use cleanLDAPResult()
This commit is contained in:
parent
9f5570482e
commit
8b9d668f38
|
@ -138,7 +138,7 @@ class Ldap{
|
|||
$sr = @ldap_search($this->server(), escapeDN($suffix), "objectClass=organizationalunit", array("DN"), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||
if ($sr) {
|
||||
$units = ldap_get_entries($this->server, $sr);
|
||||
unset($units['count']);
|
||||
$units = cleanLDAPResult($units);
|
||||
// extract Dns
|
||||
for ($i = 0; $i < sizeof($units); $i++) {
|
||||
if ($units[$i]['dn']) $ret[] = $units[$i]['dn'];
|
||||
|
|
|
@ -481,8 +481,6 @@ class lamList {
|
|||
protected function listPrintTableCellContent(&$entry, &$attribute) {
|
||||
// print all attribute entries seperated by "; "
|
||||
if (isset($entry[$attribute]) && sizeof($entry[$attribute]) > 0) {
|
||||
// delete "count" entry
|
||||
unset($entry[$attribute]['count']);
|
||||
if (is_array($entry[$attribute])) {
|
||||
// sort array
|
||||
sort($entry[$attribute]);
|
||||
|
@ -832,14 +830,8 @@ class lamList {
|
|||
}
|
||||
if ($sr) {
|
||||
$info = ldap_get_entries($_SESSION["ldap"]->server(), $sr);
|
||||
$info = cleanLDAPResult($info);
|
||||
ldap_free_result($sr);
|
||||
// delete first array entry which is "count"
|
||||
unset($info['count']);
|
||||
// save position in original $info
|
||||
$infoCount = sizeof($info);
|
||||
for ($i = 0; $i < $infoCount; $i++) {
|
||||
if (isset($info[$i]['count'])) unset($info[$i]['count']);
|
||||
}
|
||||
// save results
|
||||
$this->entries = $info;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,8 @@ function getChildCount($dn) {
|
|||
$sr = @ldap_search($_SESSION['ldap']->server(), escapeDN($dn), 'objectClass=*', array('dn'), 0, 0, 0, LDAP_DEREF_NEVER);
|
||||
if ($sr) {
|
||||
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
||||
$return = $entries['count'] - 1;
|
||||
$entries = cleanLDAPResult($entries);
|
||||
$return = sizeof($entries) - 1;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
@ -273,7 +274,8 @@ function deleteDN($dn) {
|
|||
$sr = @ldap_list($_SESSION['ldap']->server(), $dn, 'objectClass=*', array('dn'), 0);
|
||||
if ($sr) {
|
||||
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
||||
for ($i = 0; $i < $entries['count']; $i++) {
|
||||
$entries = cleanLDAPResult($entries);
|
||||
for ($i = 0; $i < sizeof($entries); $i++) {
|
||||
// delete recursively
|
||||
$subErrors = deleteDN($entries[$i]['dn']);
|
||||
for ($e = 0; $e < sizeof($subErrors); $e++) $errors[] = $subErrors[$e];
|
||||
|
|
|
@ -446,11 +446,12 @@ if(!empty($_POST['checklogin'])) {
|
|||
if ($searchResult) {
|
||||
$searchInfo = @ldap_get_entries($searchLDAP->server(), $searchResult);
|
||||
if ($searchInfo) {
|
||||
if ($searchInfo['count'] == 0) {
|
||||
$searchInfo = cleanLDAPResult($searchInfo);
|
||||
if (sizeof($searchInfo) == 0) {
|
||||
$searchSuccess = false;
|
||||
$searchError = _('Wrong password/user name combination. Please try again.');
|
||||
}
|
||||
elseif ($searchInfo['count'] > 1) {
|
||||
elseif (sizeof($searchInfo) > 1) {
|
||||
$searchSuccess = false;
|
||||
$searchError = _('The given user name matches multiple LDAP entries.');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue