Skip to content

LDAP: Error thrown when no CN provided by LDAP server #5443

Closed
@dofeldsc

Description

@dofeldsc

Describe the Bug

Null default value causes exception in App/Access
/LdapService.php on login.

If this is done with anonymous bind and cn is not accessible, argument 3 (userCn) for getUserDisplayName is null, which is not allowed.

$userCn = $this->getUserResponseProperty($user, 'cn', null);
        $formatted = [
            'uid'   => $this->getUserResponseProperty($user, $idAttr, $user['dn']),
            'name'  => $this->getUserDisplayName($user, $displayNameAttrs, $userCn),
            'dn'    => $user['dn'],
            'email' => $this->getUserResponseProperty($user, $emailAttr, null),
            'avatar' => $thumbnailAttr ? $this->getUserResponseProperty($user, $thumbnailAttr, null) : null,
        ];

This change came with Version 24.12, before that login with this config worked fine.
Not a breaking change, but thught you should know :)

Best regards and thanks for your work!

Steps to Reproduce

  1. LDAP-Config without LDAP_DN/LDAP_PASS
  2. LDAP where cn is not readable with anonymous
  3. Try to Login

Expected Behaviour

Login

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

24.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions