lib/Auth lib/ext
Aleksander Machniak
machniak at kolabsys.com
Thu Mar 5 11:08:41 CET 2015
lib/Auth/LDAP.php | 8 ++++++--
lib/ext/Net/LDAP3.php | 14 +++++++++-----
2 files changed, 15 insertions(+), 7 deletions(-)
New commits:
commit d5c7eeb50de5e0952a0e303a1cd1e046dbdb0eb0
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Thu Mar 5 05:07:07 2015 -0500
Fix regression related to incorrect find_domain() result handling (#4786)
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 1588500..ce0762e 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -430,7 +430,11 @@ class LDAP extends Net_LDAP3 {
$domain_dn = $this->entry_dn($domain, array(), $domain_base_dn);
if (!$domain_dn) {
- $result = $this->find_domain($domain, $attributes);
+ if ($result = $this->find_domain($domain, $attributes)) {
+ $result_dn = $result['dn'];
+ unset($result['dn']);
+ $result = array($result_dn => $result);
+ }
}
else {
$result = $this->_read($domain_dn, $attributes);
@@ -1042,7 +1046,7 @@ class LDAP extends Net_LDAP3 {
* @param string $domain Domain name
* @param array $attributes Result attributes
*
- * @return array|bool Domain attributes or False on error
+ * @return array|bool Domain attributes (+ 'dn' attribute) or False on error
*/
public function find_domain($domain, $attributes = array('*'))
{
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index 00a4483..30f40df 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -3029,7 +3029,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('*'))
{
@@ -3051,7 +3051,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;
}
}
@@ -3067,9 +3070,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);
More information about the commits
mailing list