Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
aa0cf333
Commit
aa0cf333
authored
Jan 05, 2016
by
Tom Evans
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #474 from anuko/master
Fixed group population for colliding full names.
parents
bdef6ba7
fb9c6a39
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
LdapGroupProvider.java
...ava/org/jivesoftware/openfire/ldap/LdapGroupProvider.java
+13
-4
No files found.
src/java/org/jivesoftware/openfire/ldap/LdapGroupProvider.java
View file @
aa0cf333
...
@@ -227,7 +227,7 @@ public class LdapGroupProvider extends AbstractGroupProvider {
...
@@ -227,7 +227,7 @@ public class LdapGroupProvider extends AbstractGroupProvider {
Pattern
.
compile
(
"(?i)(^"
+
manager
.
getUsernameField
()
+
"=)([^,]+)(.+)"
);
Pattern
.
compile
(
"(?i)(^"
+
manager
.
getUsernameField
()
+
"=)([^,]+)(.+)"
);
SearchControls
searchControls
=
new
SearchControls
();
SearchControls
searchControls
=
new
SearchControls
();
searchControls
.
setReturningAttributes
(
new
String
[]
{
manager
.
getUsernameField
()
});
searchControls
.
setReturningAttributes
(
new
String
[]
{
"distinguishedName"
,
manager
.
getUsernameField
()
});
// See if recursive searching is enabled. Otherwise, only search one level.
// See if recursive searching is enabled. Otherwise, only search one level.
if
(
manager
.
isSubTreeSearch
())
{
if
(
manager
.
isSubTreeSearch
())
{
searchControls
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
searchControls
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
...
@@ -283,9 +283,18 @@ public class LdapGroupProvider extends AbstractGroupProvider {
...
@@ -283,9 +283,18 @@ public class LdapGroupProvider extends AbstractGroupProvider {
NamingEnumeration
usrAnswer
=
ctx
.
search
(
""
,
NamingEnumeration
usrAnswer
=
ctx
.
search
(
""
,
userFilter
.
toString
(),
searchControls
);
userFilter
.
toString
(),
searchControls
);
if
(
usrAnswer
!=
null
&&
usrAnswer
.
hasMoreElements
())
{
if
(
usrAnswer
!=
null
&&
usrAnswer
.
hasMoreElements
())
{
Attribute
usernameAttr
=
((
SearchResult
)
usrAnswer
.
next
()).
getAttributes
().
get
(
manager
.
getUsernameField
());
SearchResult
searchResult
=
null
;
if
(
usernameAttr
!=
null
)
{
// We may get multiple search results for the same user CN.
username
=
(
String
)
usernameAttr
.
get
();
// 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
;
}
}
}
}
}
// Close the enumeration.
// Close the enumeration.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment