diff options
author | Simon Rettberg | 2017-01-18 13:37:03 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-01-18 13:37:03 +0100 |
commit | 60b0e82aa64199bbed7a81a71b7cb1cd0ffd819e (patch) | |
tree | 28c4f3bd22e39e9480d295361c42afa0044c57e6 /modules-available/sysconfig/inc | |
parent | install.js: Fix coloring for an error case (diff) | |
download | slx-admin-60b0e82aa64199bbed7a81a71b7cb1cd0ffd819e.tar.gz slx-admin-60b0e82aa64199bbed7a81a71b7cb1cd0ffd819e.tar.xz slx-admin-60b0e82aa64199bbed7a81a71b7cb1cd0ffd819e.zip |
[sysconfig] More ad/ldap setup fixes
Diffstat (limited to 'modules-available/sysconfig/inc')
-rw-r--r-- | modules-available/sysconfig/inc/ldap.inc.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules-available/sysconfig/inc/ldap.inc.php b/modules-available/sysconfig/inc/ldap.inc.php index ed471f31..23b24885 100644 --- a/modules-available/sysconfig/inc/ldap.inc.php +++ b/modules-available/sysconfig/inc/ldap.inc.php @@ -8,4 +8,18 @@ class Ldap return trim(preg_replace('/[,;]\s*/', ',', $dn)); } + public static function getSelfSearchBase($binddn, $searchbase) + { + // 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 + $searchbase = $out[1]; + } + return $searchbase; + } + } |