summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-21 15:09:12 +0100
committerSimon Rettberg2017-12-21 15:09:12 +0100
commitd36088e73f67028818c4836496faf726fe256b9b (patch)
tree56b0d8339b010fa06926739b93f7e82e5f9ed749 /modules-available/sysconfig
parent[statistics] Cleaner version for screen connection state handling by using ne... (diff)
downloadslx-admin-d36088e73f67028818c4836496faf726fe256b9b.tar.gz
slx-admin-d36088e73f67028818c4836496faf726fe256b9b.tar.xz
slx-admin-d36088e73f67028818c4836496faf726fe256b9b.zip
[sysconfig] Fix home directory attribute detection
Diffstat (limited to 'modules-available/sysconfig')
-rw-r--r--modules-available/sysconfig/addmodule_adauth.inc.php15
-rw-r--r--modules-available/sysconfig/addmodule_ldapauth.inc.php2
-rw-r--r--modules-available/sysconfig/inc/ldap.inc.php6
3 files changed, 9 insertions, 14 deletions
diff --git a/modules-available/sysconfig/addmodule_adauth.inc.php b/modules-available/sysconfig/addmodule_adauth.inc.php
index 2c32e4a8..df7f385d 100644
--- a/modules-available/sysconfig/addmodule_adauth.inc.php
+++ b/modules-available/sysconfig/addmodule_adauth.inc.php
@@ -31,7 +31,7 @@ class AdAuth_Start extends AddModule_Base
if (isset($data['server']) && preg_match('/^(.*)\:(636|3269|389|3268)$/', $data['server'], $out)) {
$data['server'] = $out[1];
}
- if (isset($data['homeattr']) && !isset($data['mapping']['homemount'])) {
+ if (isset($data['homeattr']) && !isset($data['mapping']['homemount']) && strtolower($data['homeattr']) !== 'homedirectory') {
$data['mapping']['homemount'] = $data['homeattr'];
}
$data['step'] = 'AdAuth_CheckConnection';
@@ -96,6 +96,7 @@ class AdAuth_CheckConnection extends AddModule_Base
protected function renderInternal()
{
+ $mapping = Request::post('mapping', false, 'array');
$data = array(
'edit' => Request::post('edit'),
'title' => Request::post('title'),
@@ -104,17 +105,16 @@ class AdAuth_CheckConnection extends AddModule_Base
'binddn' => $this->bindDn,
'bindpw' => Request::post('bindpw'),
'home' => Request::post('home'),
- 'homeattr' => Request::post('homeattr'),
'ssl' => Request::post('ssl'),
'fixnumeric' => Request::post('fixnumeric'),
'certificate' => Request::post('certificate', ''),
'taskid' => $this->scanTask['id'],
- 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')),
+ 'mapping' => ConfigModuleBaseLdap::getMapping($mapping),
);
$data['prev'] = 'AdAuth_Start';
if ((preg_match(AD_BOTH_REGEX, $this->bindDn) > 0) || (strlen($this->searchBase) < 2)) {
$data['next'] = 'AdAuth_SelfSearch';
- } elseif (empty($data['homeattr'])) {
+ } elseif (empty($mapping['homemount'])) {
$data['next'] = 'AdAuth_HomeAttrCheck';
} else {
$data['next'] = 'AdAuth_CheckCredentials';
@@ -196,6 +196,7 @@ class AdAuth_SelfSearch extends AddModule_Base
protected function renderInternal()
{
+ $mapping = Request::post('mapping', false, 'array');
$data = array(
'edit' => Request::post('edit'),
'title' => Request::post('title'),
@@ -205,16 +206,15 @@ class AdAuth_SelfSearch extends AddModule_Base
'binddn' => Request::post('binddn'),
'bindpw' => Request::post('bindpw'),
'home' => Request::post('home'),
- 'homeattr' => Request::post('homeattr'),
'ssl' => Request::post('ssl') === 'on',
'fixnumeric' => Request::post('fixnumeric'),
'fingerprint' => Request::post('fingerprint'),
'certificate' => Request::post('certificate', ''),
'originalbinddn' => $this->originalBindDn,
- 'mapping' => ConfigModuleBaseLdap::getMapping(Request::post('mapping', false, 'array')),
+ 'mapping' => ConfigModuleBaseLdap::getMapping($mapping),
'prev' => 'AdAuth_Start'
);
- if (empty($data['homeattr'])) {
+ if (empty($mapping['homemount'])) {
$data['next'] = 'AdAuth_HomeAttrCheck';
} else {
$data['next'] = 'AdAuth_CheckCredentials';
@@ -283,7 +283,6 @@ class AdAuth_HomeAttrCheck extends AddModule_Base
'binddn' => Request::post('binddn'),
'bindpw' => Request::post('bindpw'),
'home' => Request::post('home'),
- 'homeattr' => Request::post('homeattr'),
'ssl' => Request::post('ssl') === 'on',
'fixnumeric' => Request::post('fixnumeric'),
'fingerprint' => Request::post('fingerprint'),
diff --git a/modules-available/sysconfig/addmodule_ldapauth.inc.php b/modules-available/sysconfig/addmodule_ldapauth.inc.php
index e0de06ac..1db6cb51 100644
--- a/modules-available/sysconfig/addmodule_ldapauth.inc.php
+++ b/modules-available/sysconfig/addmodule_ldapauth.inc.php
@@ -23,7 +23,7 @@ class LdapAuth_Start extends AddModule_Base
if (isset($data['server']) && preg_match('/^(.*)\:(636|389)$/', $data['server'], $out)) {
$data['server'] = $out[1];
}
- if (isset($data['homeattr']) && !isset($data['mapping']['homemount'])) {
+ if (isset($data['homeattr']) && !isset($data['mapping']['homemount']) && strtolower($data['homeattr']) !== 'homedirectory') {
$data['mapping']['homemount'] = $data['homeattr'];
}
$data['step'] = 'LdapAuth_CheckConnection';
diff --git a/modules-available/sysconfig/inc/ldap.inc.php b/modules-available/sysconfig/inc/ldap.inc.php
index 23b24885..349a662e 100644
--- a/modules-available/sysconfig/inc/ldap.inc.php
+++ b/modules-available/sysconfig/inc/ldap.inc.php
@@ -12,11 +12,7 @@ class Ldap
{
// To find ourselves we try to figure out the proper search base, since the given one
// might be just for users, not for functional or utility accounts
- if (preg_match('/,(OU=.*DC=.*)$/i', Ldap::normalizeDn($binddn), $out)) {
- // Get OU from binddn; works if not given short form of DOMAIN\user or user@domain.fqdn.com
- $searchbase = $out[1];
- } elseif (preg_match('/,(DC=.*)$/i', Ldap::normalizeDn($searchbase), $out)) {
- // Otherwise, shorten search base enough to only consider the DC=..,DC=.. part at the end
+ if (preg_match('/^\w+=[^=]+,(.*)$/i', Ldap::normalizeDn($binddn), $out)) {
$searchbase = $out[1];
}
return $searchbase;