blob: 349a662e1bd803b0b028c106c50d75e11d06a902 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<?php
class Ldap
{
public static function normalizeDn($dn)
{
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('/^\w+=[^=]+,(.*)$/i', Ldap::normalizeDn($binddn), $out)) {
$searchbase = $out[1];
}
return $searchbase;
}
}
|