summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-13 15:32:25 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-13 15:32:25 +0200
commit7679bf67ddc92c25e06e11d5a9dbd6e252dfcc6a (patch)
tree868b183753c1116a11f2f13a34a2895f338cf3dc
parent8c5f41681ed06058450ce84fc4e5f0961115575a (diff)
downloadwebadmin-7679bf67ddc92c25e06e11d5a9dbd6e252dfcc6a.tar.gz
Use a fallback of 'domain.tld' if 'domain_tld' is not matching anything, and fall back further to 'userRoot'
-rw-r--r--lib/Auth/LDAP.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 2afd737..858c422 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -1127,12 +1127,30 @@ class LDAP extends Net_LDAP3 {
}
$result = $this->_read("cn=" . str_replace('.', '_', $this->conf->get('kolab', 'primary_domain') . ",cn=ldbm database,cn=plugins,cn=config"), array('nsslapd-directory'));
+ if (!$result) {
+ $result = $this->_read("cn=" . $this->conf->get('kolab', 'primary_domain') . ",cn=ldbm database,cn=plugins,cn=config", array('nsslapd-directory'));
+ }
+
+ if (!$result) {
+ $result = $this->_read("cn=userRoot,cn=ldbm database,cn=plugins,cn=config", array('nsslapd-directory'));
+ }
$this->_log(LOG_DEBUG, "Primary domain ldbm database configuration entry: " . var_export($result, TRUE));
$result = $result[key($result)];
+
+ $orig_directory = $result['nsslapd-directory'];
+
$directory = str_replace(str_replace('.', '_', $this->conf->get('kolab', 'primary_domain')), str_replace('.','_',$domain_name), $result['nsslapd-directory']);
+ if ($directory == $orig_directory) {
+ $directory = str_replace($this->conf->get('kolab', 'primary_domain'), str_replace('.','_',$domain_name), $result['nsslapd-directory']);
+ }
+
+ if ($directory == $orig_directory) {
+ $directory = str_replace("userRoot", str_replace('.','_',$domain_name), $result['nsslapd-directory']);
+ }
+
$dn = "cn=" . str_replace('.', '_', $domain_name) . ",cn=ldbm database,cn=plugins,cn=config";
$attrs = array(
'objectclass' => array(