summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-10 07:31:34 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-09-10 07:31:34 (GMT)
commit5f641c1509584f34dbe93d7ec735cff846dea1ff (patch)
treeb4fd5122d3e1c71a90db9898f933bc90c1aa8217
parent4ba996a4a12e73eb4d3708e3633e2b6702e49885 (diff)
downloadNet_LDAP3-5f641c1509584f34dbe93d7ec735cff846dea1ff.tar.gz
Fix unhandled ldap errors + some CS fixes (Bug #2201)
-rw-r--r--lib/Net/LDAP3.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index a2b3e90..b8b9f9f 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -878,7 +878,7 @@ class Net_LDAP3
")");
if ($entries) {
- $groups = array_keys($entries->entries(TRUE));
+ $groups = array_keys($entries->entries(TRUE));
}
return $groups;
@@ -1098,6 +1098,10 @@ class Net_LDAP3
$entry = $this->search($dn);
+ if (!$entry) {
+ return array();
+ }
+
$this->_debug("ENTRIES for \$dn $dn", $entry);
foreach ($entry[$dn] as $attribute => $value) {
@@ -1778,13 +1782,13 @@ class Net_LDAP3
$this->find_vlv_indexes_and_searches(true);
}
- if (empty($this->_vlv_indexes_and_searches) && !is_array($this->_vlv_indexes_and_searches)) {
+ if (empty($this->_vlv_indexes_and_searches)) {
return false;
}
$this->_debug("Existing vlv index and search information", $this->_vlv_indexes_and_searches);
- if (array_key_exists($base_dn, $this->_vlv_indexes_and_searches) && !empty($this->_vlv_indexes_and_searches[$base_dn])) {
+ if (!empty($this->_vlv_indexes_and_searches[$base_dn])) {
$this->_debug("Found a VLV for base_dn: " . $base_dn);
if ($this->_vlv_indexes_and_searches[$base_dn]['filter'] == $filter) {
$this->_debug("Filter matches");
@@ -1855,6 +1859,11 @@ class Net_LDAP3
0
);
+ if ($search_result === false) {
+ $this->_debug("Search for '(objectclass=vlvsearch)' on '$config_root_dn' failed:".ldap_error($this->conn));
+ return;
+ }
+
$vlv_searches = new Net_LDAP3_Result($this->conn, $config_root_dn, '(objectclass=vlvsearch)', 'sub', $search_result);
if ($vlv_searches->count() < 1) {
@@ -1883,6 +1892,10 @@ class Net_LDAP3
0
);
+ if ($index_result === false) {
+ $this->_debug("Search for '(objectclass=vlvindex)' on '$vlv_search_dn' failed:".ldap_error($this->conn));
+ continue;
+ }
$vlv_indexes = new Net_LDAP3_Result($this->conn, $vlv_search_dn, '(objectclass=vlvindex)', 'sub', $index_result);
$vlv_indexes = $vlv_indexes->entries(true);