Github user mike-jumper commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/129#discussion_r106697645
  
    --- 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) {
    +                    logger.debug("Ignoring LDAP Referral: \"{}\".", 
e.toString());
    --- End diff --
    
    As mentioned in the comments on 
[GUACAMOLE-243](https://issues.apache.org/jira/browse/GUACAMOLE-243), ignoring 
all LDAP referrals is not really a solution unless there is an option to follow 
them.
    
    Warning that an LDAP referral has occurred and isn't being followed is 
good, but:
    
    1. Such a warning would naturally need to be at the "warning" log level.
    2. The details of the exception should be logged at the "debug" level (ie: 
`logger.debug("Some contextual message about what just happened.", e)`, *not* 
`e.toString()` or there won't be any stacktraces at the debug level).
    
    Normally, non-debug log messages use `e.getMessage()` to pull some 
additional human-readable context while excluding the stacktrace, but if the 
`LDAPReferralException` will only ever occur for non-followed referrals, that 
may be just noise here.


---
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.
---

Reply via email to