}
static public function dn2ocname($dn, $ldapname = null, $isUser = true) {
+ $dn = self::sanitizeDN($dn);
$table = self::getMapTable($isUser);
if($isUser) {
$nameAttribute = self::conf('ldapUserDisplayName');
*/
static private function mapComponent($dn, $ocname, $isUser = true) {
$table = self::getMapTable($isUser);
+ $dn = self::sanitizeDN($dn);
$sqliteAdjustment = '';
$dbtype = OCP\Config::getSystemValue('dbtype');
if($key != 'dn'){
$selection[$i][$key] = $item[$key][0];
} else {
- $selection[$i][$key] = $item[$key];
+ $selection[$i][$key] = self::sanitizeDN($item[$key]);
}
}
$key = strtolower($attr[0]);
if(isset($item[$key])) {
- $selection[] = $item[$key];
+ if($key == 'dn') {
+ $selection[] = self::sanitizeDN($item[$key]);
+ } else {
+ $selection[] = $item[$key];
+ }
}
}
return $findings;
}
+ static private function sanitizeDN($dn) {
+ //OID sometimes gives back DNs with whitespace after the comma a la "uid=foo, cn=bar, dn=..." We need to tackle this!
+ $dn = preg_replace('/,\s+/',',',$dn);
+
+ return $dn;
+ }
+
/**
* @brief combines the input filters with AND
* @param $filters array, the filters to connect