diff --git a/include/class_objects.inc b/include/class_objects.inc index 7fc6b55fd8c48c106d9f9b70bd155619e10a6d2c..6614ef8602ac14faf87e7cf6104d77892fd2077c 100644 --- a/include/class_objects.inc +++ b/include/class_objects.inc @@ -42,7 +42,7 @@ class objects * * \return The list of objects as an associative array (keys are dns) */ - static function ls ($types, $attrs = NULL, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE) + static function ls ($types, $attrs = NULL, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE, $sizeLimit = FALSE) { global $ui, $config; @@ -105,7 +105,7 @@ class objects } try { - $ldap = static::search($types, $search_attrs, $ou, $filter, $checkAcl, $scope, $templateSearch, $partialFilterAcls); + $ldap = static::search($types, $search_attrs, $ou, $filter, $checkAcl, $scope, $templateSearch, $partialFilterAcls, $sizeLimit); } catch (NonExistingBranchException $e) { return array(); } @@ -181,7 +181,7 @@ class objects return $ldap->count(); } - private static function search ($types, $search_attrs, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE, &$partialFilterAcls = array()) + private static function search ($types, $search_attrs, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE, &$partialFilterAcls = array(), $sizeLimit = FALSE) { global $config, $ui; @@ -215,7 +215,7 @@ class objects throw new EmptyFilterException(); } - $ldap = $config->get_ldap_link(); + $ldap = $config->get_ldap_link($sizeLimit); if (!$ldap->dn_exists($ou)) { throw new NonExistingBranchException(); } @@ -259,7 +259,12 @@ class objects $ldap->cd($ou); $ldap->search($filter, $search_attrs, $scope); if (!$ldap->success()) { - throw new LDAPFailureException($ldap->get_error()); + if ($sizeLimit && preg_match('/size limit/i', $ldap->get_error())) { + // Check for size limit exceeded messages for GUI feedback + $ui->getSizeLimitHandler()->setLimitExceeded(); + } else { + throw new LDAPFailureException($ldap->get_error()); + } } return $ldap; } diff --git a/include/management/class_managementFilter.inc b/include/management/class_managementFilter.inc index 77e78b6909c4d6b2e0641042f9495de65260c2ec..1f4c72440c201000e1ca47448cd6c254ef2eaa97 100644 --- a/include/management/class_managementFilter.inc +++ b/include/management/class_managementFilter.inc @@ -184,7 +184,7 @@ class managementFilter $filter = '(&'.implode('', $typeElementFilters).')'; } - $ldapEntries = objects::ls($type, $attrsAsked, $searchBase, $filter, TRUE, $this->scope); + $ldapEntries = objects::ls($type, $attrsAsked, $searchBase, $filter, TRUE, $this->scope, FALSE, TRUE); $objectTypeCount[$type] = count($ldapEntries); foreach ($ldapEntries as $dn => $entry) {