Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-4321

Ametys crashes when LDAP user directory attribute exists but has no value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.9.8, 4.10.0
    • 4.9.6
    • None
    • None
    • 4.10 M6
    • Oui

      When synchronizing or retrieving users from LDAP, Ametys throws an exception if the givenName (first name) attribute exists in LDAP but has no value.

      Instead of handling the empty attribute gracefully, the application crashes with a NoSuchElementException.

      This situation can occur when the attribute is present in the LDAP but empty for some users.

      Steps to Reproduce:

      1. Create or modify a user entry in LDAP.
      1. Set an attribute (for example the one used by the User Directory as the first name) so that it exists but contains an empty value.
      1. List users in cms or admin workspace

      Expected Behavior:
      Ametys should ignore the empty attribute and retrieve the other users

      Actual Behavior:
      Ametys throws an exception and fails to retrieve users.

      Error Stack Trace:

      Caused by: java.util.NoSuchElementException: Attribute givenName has no value
      at java.naming/javax.naming.directory.BasicAttribute#get:299
      at org.ametys.plugins.core.impl.user.directory.LdapUserDirectory#_getAttributes:947
      at org.ametys.plugins.core.impl.user.directory.LdapUserDirectory#_users:748
      at org.ametys.plugins.core.impl.user.directory.LdapUserDirectory#_internalGetUsers:688
      at org.ametys.plugins.core.impl.user.directory.LdapUserDirectory#getStoredUsers:318
      at org.ametys.core.user.UserManager#getUsers:317
      at org.ametys.core.user.UserManager#getUsers:268
      at org.ametys.plugins.core.user.UserDAO#searchUsersByPopulation:248
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor#invoke:103
      ... 91 more

       
       
       

            ggouin Guillaume Gouin
            jhawken James Hawken
            Guillaume Gouin Guillaume Gouin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: