LDAP / getAttributes in /user_ldap/lib/User/Manager.php

Hello,

I tried to enable LDAP user accounts (it’s a little bit compilicated, because i got only a few attributes (mail,sn,givenName,uid) via the LDAP (Novell eDirectory)). I’m using Nextcloud 12.0.2.
I got a apache segfault when starting the user administration and a endless loop while searching for users within the sharing interface (In the debug log are a lots of lines trying to get the attributes of the same user repeatedly until I killed apache2) . Via tcpdump and the debug log I analysed the LDAP communication and found some weird requests with empty atrributes and the same attribute multiple times in the attribute list.
So I tried to fix it. Because I don’t know how to report correctly, I will post the fix, which worked for me, here (only 2 changes):
In /user_ldap/lib/User/Manager.php, function

public function getAttributes($minimal = false)
, I changed
if(!is_null($attr)) {
to
if((!is_null($attr)) && (!empty($attr))) {
and added
$attributes = array_unique($attributes);
before the
return $attributes;
. Maybe it’s possible to integrate in next version.

Alexander

The best way to report a bug is on Github. You could even fork the project, commit your changes, and send a pull request (if you want to get fancy).
Submit your Nextcloud Server issue here for the developers to review: https://github.com/nextcloud/server/issues