Nextcloud LDAP not working for new users

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 25.0.8
Operating system and version (eg, Ubuntu 20.04): CentOS Linux release 8.5.2111
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.37 (centos)
PHP version (eg, 7.4): PHP 7.4.19 (cli)

The issue you are facing:
I have set up Nextcloud to work with LDAP. Our company operates an Active Directory, which can be accessed by LDAP for users to authenticate.
Since 2023, it is no longer possible for new users to login using LDAP, however, “old” users that used Nextcloud before can still log in fine using their active directory credentials.
When I manually do an ldapsearch for an account that does not work and compare the results with an account that works fine, I cannot spot a difference; for example, the %uid is compared with the sAMAccountName, and that is set correctly in all cases.
In the Nextcloud error log, I can see an Error:

LDAP Login: Could not get user object for DN cn=,ou=employees,ou=,dc=,dc=,dc=ch. Maybe the LDAP entry has no set display name attribute?

but when I check, I can see that the display name attribute is set correctly for that user.

Also the LDAP config is correct according to the “Administrative Settings/LDAP Integration” page.

Where should I start looking for the issue?