Github user alt36 commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/129#discussion_r106703061
--- Diff:
extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
---
@@ -101,21 +102,24 @@ private void putAllUsers(Map<String, User> users,
LDAPConnection ldapConnection,
// Read all visible users
while (results.hasMore()) {
-
- LDAPEntry entry = results.next();
-
- // Get username from record
- LDAPAttribute username =
entry.getAttribute(usernameAttribute);
- if (username == null) {
- logger.warn("Queried user is missing the username
attribute \"{}\".", usernameAttribute);
- continue;
+ try {
+ LDAPEntry entry = results.next();
+
+ // Get username from record
+ LDAPAttribute username =
entry.getAttribute(usernameAttribute);
+ if (username == null) {
+ logger.warn("Queried user is missing the username
attribute \"{}\".", usernameAttribute);
+ continue;
+ }
+
+ // Store user using their username as the identifier
+ String identifier = username.getStringValue();
+ if (users.put(identifier, new SimpleUser(identifier))
!= null)
+ logger.warn("Possibly ambiguous user account:
\"{}\".", identifier);
+
+ } catch (LDAPReferralException e) {
--- End diff --
Thanks for the feedback - I honestly thought I was following what I'd seen
elsewhere in the code, but evidently I wasn't paying close enough attention!
I'll read the style guide more carefully next time :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---