Github user necouchman commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-client/pull/202#discussion_r149263698
--- Diff:
extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserService.java
---
@@ -107,19 +108,36 @@ private void putAllUsers(Map<String, User> users,
LDAPConnection ldapConnection,
// Read all visible users
while (results.hasMore()) {
- LDAPEntry entry = results.next();
+ 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);
- // 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);
+ // Deal with errors trying to follow referrals
+ catch (LDAPReferralException e) {
+ if (confService.getFollowReferrals()) {
+ logger.error("Could not follow referral: {}",
e.getFailedReferral());
+ logger.debug("Error encountered trying to follow
referral.", e);
+ throw new GuacamoleServerException("Could not
follow LDAP referral.", e);
+ }
+ else {
+ logger.warn("Given a referral, but referrals are
disabled.", e.getMessage());
--- End diff --
Fixed.
---