summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2015-03-05 10:09:29 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2015-03-05 10:09:29 (GMT)
commit85ffcf7964242eb2f1f4d8020d2b61b33d36b9f6 (patch)
treee14b9cc120afb756822da64c145f31e15da046bc
parent625dcd7ad38beb518017c146693acb84d8404667 (diff)
downloadNet_LDAP3-85ffcf7964242eb2f1f4d8020d2b61b33d36b9f6.tar.gz
Return domain DN in find_domain() result (#4786)
-rw-r--r--lib/Net/LDAP3.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 8ce2b56..5ace6bc 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -3030,7 +3030,7 @@ class Net_LDAP3
* @param string $domain Domain name
* @param array $attributes Result attributes
*
- * @return array|bool Domain attributes or False if not found
+ * @return array|bool Domain attributes (plus 'dn' attribute) or False if not found
*/
public function find_domain($domain, $attributes = array('*'))
{
@@ -3052,7 +3052,10 @@ class Net_LDAP3
if ($domain_dn) {
$result = $this->get_entry_attributes($domain_dn, $attributes);
- if (empty($result)) {
+ if (!empty($result)) {
+ $result['dn'] = $domain_dn;
+ }
+ else {
$result = false;
}
}
@@ -3068,9 +3071,10 @@ class Net_LDAP3
$domain_filter = "(&" . $domain_filter . "(" . $name_attribute . "=" . self::quote_string($domain) . "))";
if ($result = $this->search($domain_base_dn, $domain_filter, 'sub', $attributes)) {
- $result = $result->entries(true);
- $domain_dn = key($result);
- $result = $result[$domain_dn];
+ $result = $result->entries(true);
+ $domain_dn = key($result);
+ $result = $result[$domain_dn];
+ $result['dn'] = $domain_dn;
// cache domain DN
$this->set_cache_data($ckey, $domain_dn);