summaryrefslogtreecommitdiffstats
path: root/lib/Auth
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2015-03-05 05:24:09 -0500
committerAleksander Machniak <machniak@kolabsys.com>2015-03-05 05:24:09 -0500
commit56a0b8eb70e4567ca7f973409321a031297f96a6 (patch)
tree9cca8f78bab99601e0e07f5bacb0c479b31f109d /lib/Auth
parentd5c7eeb50de5e0952a0e303a1cd1e046dbdb0eb0 (diff)
downloadwebadmin-56a0b8eb70e4567ca7f973409321a031297f96a6.tar.gz
Fix "illegal offset" error and small perf. issue in domain_is_empty() (#4791)
Diffstat (limited to 'lib/Auth')
-rw-r--r--lib/Auth/LDAP.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index ce0762e..2e28c1e 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -448,25 +448,29 @@ class LDAP extends Net_LDAP3 {
/**
* Checkes if specified domain is empty (no users assigned)
*
- * @param string $domain Domain name
+ * @param string|array $domain Domain name or domain_info() result
*
* @return bool True if domain is empty, False otherwise
*/
public function domain_is_empty($domain)
{
- $this->_log(LOG_DEBUG, "Auth::LDAP::domain_is_empty($domain)");
-
$domain_name_attribute = $this->conf->get('ldap', 'domain_name_attribute');
if (empty($domain_name_attribute)) {
$domain_name_attribute = 'associateddomain';
}
- $domain = $this->domain_info($domain);
+ if (!is_array($domain)) {
+ $domain = $this->domain_info($domain);
+ }
if (!empty($domain)) {
$domain_dn = key($domain);
$domain_name = $domain[$domain_dn][$domain_name_attribute];
+
+ if (is_array($domain_name)) {
+ $domain_name = $domain_name[0];
+ }
}
else {
return false;