Background:
The "Base DNs for LDAP users, groups, and other entries." can contain multiple entries.
This is stored by the form as a "\r\n" separated list.
The \Drupal\ldap_servers\Entity\Server::getBaseDn() method explodes this back into an array.

Issue:
Users can't be found. Log message is: LDAP search error: Invalid DN syntax (34). Context is base DN: ...

Cause:
When the config is stored in git or edited on non-windows machines these line endings get converted to "\n" and the explode will create a single invalid basedn.

Workaround:
Open the server edit form and save it. This will restore the expected separators.

Solutions:
- Simple fix: strip "\r" and then split on "\n"
- Less simple: Follow the TODO comment: // @TODO: Improve storage in database (should be a proper array)./

Comments

JvE created an issue. See original summary.

JvE’s picture

JvE’s picture

Status: Active » Needs review
JvE’s picture

JvE’s picture

grahl’s picture

Assigned: Unassigned » grahl

  • grahl committed 43a3e4f on 8.x-4.x authored by JvE
    Issue #3106481 by JvE, grahl: Issue with multiple basedns and line...
grahl’s picture

Status: Needs review » Fixed

Thanks for the input JvE, I believe you are in a bit of a corner-case since afaik most browser do send line breaks on text areas as \r\n and modifying the config should not be directly an issue. Either way, it's an unsatisfying experience at the moment.

I've taken your regular expression and moved it into the form itself (don't really have the time now to move that into a better form element) but at least it's contained there. The underlying storage is now an array, so that should make real-world handling more consistent.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.