summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-08-01 19:00:21 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-08-01 19:00:21 (GMT)
commit7803d0ff71b339aa5a252cd62030be9bda965583 (patch)
tree26aec505b3fe1e7881e53bbe26f14d286a3bfb08
parent5900f814f64e2a4df3daf4c95eaf31ad73ad0fd6 (diff)
downloadNet_LDAP3-7803d0ff71b339aa5a252cd62030be9bda965583.tar.gz
Allow multiple VLV definitions for the same base dn
-rw-r--r--lib/Net/LDAP3.php59
1 files changed, 30 insertions, 29 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 435707c..b101b4a 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -1837,41 +1837,40 @@ class Net_LDAP3
$filter = strtolower($filter);
- if (!empty($vlv_indexes[$base_dn])) {
- $this->_debug("Found a VLV for base_dn: " . $base_dn);
- if ($vlv_indexes[$base_dn]['filter'] == $filter) {
- if ($vlv_indexes[$base_dn]['scope'] == $scope) {
- $this->_debug("Scope and filter matches");
-
- // Not passing any sort attributes means you don't care
- if (!empty($sort_attrs)) {
- $sort_attrs = (array) $sort_attrs;
- if (count(array_intersect($sort_attrs, $vlv_indexes[$base_dn]['sort'])) == count($sort_attrs)) {
- return $sort_attrs;
+ foreach ($vlv_indexes as $vlv_index) {
+ if (!empty($vlv_index[$base_dn])) {
+ $this->_debug("Found a VLV for base_dn: " . $base_dn);
+ if ($vlv_index[$base_dn]['filter'] == $filter) {
+ if ($vlv_index[$base_dn]['scope'] == $scope) {
+ $this->_debug("Scope and filter matches");
+
+ // Not passing any sort attributes means you don't care
+ if (!empty($sort_attrs)) {
+ $sort_attrs = (array) $sort_attrs;
+ if (count(array_intersect($sort_attrs, $vlv_index[$base_dn]['sort'])) == count($sort_attrs)) {
+ return $sort_attrs;
+ }
+ else {
+ return false;
+ }
}
else {
- return false;
+ return $vlv_index[$base_dn]['sort'][0];
}
}
else {
- return $vlv_indexes[$base_dn]['sort'][0];
+ $this->_debug("Scope does not match. VLV: " . var_export($vlv_index[$base_dn]['scope'], true)
+ . " while looking for " . var_export($scope, true));
+ return false;
}
}
else {
- $this->_debug("Scope does not match. VLV: " . var_export($vlv_indexes[$base_dn]['scope'], true)
- . " while looking for " . var_export($scope, true));
- return false;
+ $this->_debug("Filter does not match");
}
}
- else {
- $this->_debug("Filter does not match");
- return false;
- }
- }
- else {
- $this->_debug("No VLV for base dn", $base_dn);
- return false;
}
+
+ return false;
}
/**
@@ -1948,11 +1947,13 @@ class Net_LDAP3
$_vlv_sort[] = explode(' ', $vlv_index_attrs['vlvsort']);
}
- $this->_vlv_indexes_and_searches[$_vlv_base_dn] = array(
- 'scope' => self::scopeint2str($_vlv_scope),
- 'filter' => strtolower($_vlv_filter),
- 'sort' => $_vlv_sort,
- );
+ $this->_vlv_indexes_and_searches[] = array(
+ $_vlv_base_dn => array(
+ 'scope' => self::scopeint2str($_vlv_scope),
+ 'filter' => strtolower($_vlv_filter),
+ 'sort' => $_vlv_sort,
+ ),
+ );
}
// cache this