Commit 68c0d0a2 authored by Côme Bernigaud's avatar Côme Bernigaud
Browse files

Fixes #2407 cn should not be unique

parent 51bfbb08
......@@ -185,10 +185,10 @@ class objects
if ($text === NULL) {
$ldap = $config->get_ldap_link();
$ldap->cat($dn, array($infos['mainAttr']));
$ldap->cat($dn, array($infos['nameAttr']));
if ($attrs = $ldap->fetch()) {
if (isset($attrs[$infos['mainAttr']][0])) {
$text = $attrs[$infos['mainAttr']][0];
if (isset($attrs[$infos['nameAttr']][0])) {
$text = $attrs[$infos['nameAttr']][0];
} else {
$text = $dn;
}
......@@ -196,7 +196,7 @@ class objects
throw new Exception('Dn '.$dn.' not found in LDAP');
}
} elseif (is_array($text)) {
$text = $text[$infos['mainAttr']][0];
$text = $text[$infos['nameAttr']][0];
}
if ($icon && isset($infos['icon'])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment