Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/299#discussion_r194165752
  
    --- Diff: 
extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/AuthenticationProviderService.java
 ---
    @@ -236,6 +253,58 @@ public AuthenticatedUser authenticateUser(Credentials 
credentials)
     
         }
     
    +    /**
    +     * Returns all custom LDAP attributes on the user currently bound under
    +     * the given LDAP connection. The custom attributes are specified in
    +     * guacamole.properties.
    +     *
    +     * @param ldapConnection
    +     *     LDAP connection to find the custom LDAP attributes.
    +     * @param username
    +     *     The username of the user whose attributes are queried.
    +     *
    +     * @return
    +     *     All attributes on the user currently bound under the
    +     *     given LDAP connection, as a map of attribute name to
    +     *     corresponding attribute value.
    +     *
    +     * @throws LDAPException
    +     *     If an error occurs while searching for the user attributes.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs retrieving the user DN.
    +     */
    +    private Map<String, String> getLDAPAttributes(LDAPConnection 
ldapConnection,
    +            String username) throws LDAPException, GuacamoleException {
    +
    +        // Get attributes from configuration information
    +        List<String> attrList = confService.getAttributes();
    +
    +        // If there are no attributes there is no reason to search LDAP
    +        if (attrList.size() == 0)
    --- End diff --
    
    Two things:
    - You probably also need to check `if attrList == null` here, since the 
configuration service doesn't have a default and so could return `null` if the 
attribute is not specified.  The `StringListProperty` returns `null` if the 
value is not specified, so this will like trigger a `NullPointerException`.
    - You can simplify the above to `attrList.isEmpty()`


---

Reply via email to