diff options
author | Christoph Schulthess | 2017-02-23 14:43:05 +0100 |
---|---|---|
committer | Christoph Schulthess | 2017-02-23 14:43:05 +0100 |
commit | a87a14b9dc6670d1111b8204ae7a1ca14d814c57 (patch) | |
tree | 6b3c528804a91ced4ee14bbc4c31fb24541aa4c5 /modules-available/sysconfig/inc/ldap.inc.php | |
parent | debugrequest updated, using default SSL Relay Task (diff) | |
parent | [inc/property] Add list-of-values interface (diff) | |
download | slx-admin-a87a14b9dc6670d1111b8204ae7a1ca14d814c57.tar.gz slx-admin-a87a14b9dc6670d1111b8204ae7a1ca14d814c57.tar.xz slx-admin-a87a14b9dc6670d1111b8204ae7a1ca14d814c57.zip |
Merge branch 'master' of git.openslx.org:openslx-ng/slx-admin into remote-debug
Diffstat (limited to 'modules-available/sysconfig/inc/ldap.inc.php')
-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; + } + } |