summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-04 13:51:48 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-04 13:51:48 (GMT)
commitbf032097230599ee842d3e7ca85ccd20a9c9d160 (patch)
treefb50895b2af9585652c1925330e4615b31167bef /lib
parent6b485761794e237b4f582147059beeec214712eb (diff)
downloadNet_LDAP3-bf032097230599ee842d3e7ca85ccd20a9c9d160.tar.gz
Fix get_entry_attribute() and get_entry_attributes()
Diffstat (limited to 'lib')
-rw-r--r--lib/Net/LDAP3.php23
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 9540f9f..d1714de 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -675,27 +675,22 @@ class Net_LDAP3
public function get_entry_attribute($subject_dn, $attribute)
{
- $this->config_set('return_attributes', $attributes);
- $result = $this->search($subject_dn, '(objectclass=*)', 'base');
- $dn = key($result);
- $attr = key($result[$dn]);
+ $this->config_set('return_attributes', $attribute);
+ $entries = $this->search($subject_dn, '(objectclass=*)', 'base')->entries(TRUE);
+ $entry_dn = key($entries);
+ $entry = $entries[$entry_dn];
- return $result[$dn][$attr];
+ return $entry[$attribute];
}
public function get_entry_attributes($subject_dn, $attributes)
{
$this->config_set('return_attributes', $attributes);
- $entries = $this->search($subject_dn, '(objectclass=*)', 'base');
- $entry = $entries->entries(TRUE);
- $result = $entry[0];
-
- if (!empty($result)) {
- $result = array_pop($result);
- return $result;
- }
+ $entries = $this->search($subject_dn, '(objectclass=*)', 'base')->entries(TRUE);
+ $entry_dn = key($entries);
+ $entry = $entries[$entry_dn];
- return FALSE;
+ return $entry;
}
/*