Commit 63b0a4f7 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-1041: Revert "Fixed group population for colliding full names."

This reverts commit fb9c6a39.
Instead of the code change, Openfire should be configured with unique
identifiers in its system property 'ldap.usernameField'.
parent 69ede3dd
......@@ -227,7 +227,7 @@ public class LdapGroupProvider extends AbstractGroupProvider {
Pattern.compile("(?i)(^" + manager.getUsernameField() + "=)([^,]+)(.+)");
SearchControls searchControls = new SearchControls();
searchControls.setReturningAttributes(new String[] { "distinguishedName", manager.getUsernameField() });
searchControls.setReturningAttributes(new String[] { manager.getUsernameField() });
// See if recursive searching is enabled. Otherwise, only search one level.
if (manager.isSubTreeSearch()) {
searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
......@@ -283,18 +283,9 @@ public class LdapGroupProvider extends AbstractGroupProvider {
NamingEnumeration usrAnswer = ctx.search("",
userFilter.toString(), searchControls);
if (usrAnswer != null && usrAnswer.hasMoreElements()) {
SearchResult searchResult = null;
// We may get multiple search results for the same user CN.
// Iterate through the entire set to find a matching distinguished name.
while(usrAnswer.hasMoreElements()) {
searchResult = (SearchResult) usrAnswer.nextElement();
Attributes attrs = searchResult.getAttributes();
Attribute userdnAttr = attrs.get("distinguishedName");
if (username.equals((String)userdnAttr.get())) {
// Exact match found, use it.
username = (String)attrs.get(manager.getUsernameField()).get();
break;
}
Attribute usernameAttr = ((SearchResult)usrAnswer.next()).getAttributes().get(manager.getUsernameField());
if (usernameAttr != null) {
username = (String)usernameAttr.get();
}
}
// Close the enumeration.
......
Markdown is supported
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