You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Omitting %s from LDAP search filter results in corrupt search filter #9072
bugA problem with current functionality, as opposed to missing functionality (enhancement)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussion
This seems similar to #8899, but for the LDAP search filter.
Configuring an LDAP search filter without the %s placeholder results in a warning message in the log file and a corrupt search filter sent to the LDAP server. Logging in with LDAP fails. I could not find the search filter in the LDAP log files though, but that might be due to the behavior of my LDAP server when receiving a corrupt search filter.
If %s is used in LDAP search filter, everything works.
While I can agree this could behave better, (memberOf=CN=Syncthing,CN=Users,DC=example,DC=com) isn't a useful search filter -- it just says that there should exist a member of that group, but states nothing about the relation between the group and the user logging in. What's the point?
My scenario is as follows:
LDAP users that are not explicitly granted search privileges cannot see other users.
Since Syncthing performs the search with the user trying to log in instead of an explicit search bind DN, that user can only see itself. So the search filter is only there to ensure correct group membership.
Also, users can bind with user name or mail address, so users can choose whether to log in by user or mail.
The obvious workaround is to use a filter like (&(|(mail=%s)(cn=%s))(memberOf=CN=Syncthing,CN=Users,DC=example,DC=com)) which works just fine, but given the circumstances overcomplicates things.
I figured I'd report that abnormal behavior anyway.
The obvious workaround is to use a filter like (&(|(mail=%s)(cn=%s))(memberOf=CN=Syncthing,CN=Users,DC=example,DC=com)) which works just fine
Correction: It seems that multiple uses of %s are not supported in the filter, but it must occur exactly once. All following %s are replaced with %!s(MISSING), resulting in a corrupt filter: (&(|([email protected])(cn=%!s(MISSING)))(memberOf=CN=Syncthing,CN=Users,DC=example,DC=com))
bugA problem with current functionality, as opposed to missing functionality (enhancement)frozen-due-to-ageIssues closed and untouched for a long time, together with being locked for discussion
Activity
calmh commentedon Sep 2, 2023
While I can agree this could behave better,
(memberOf=CN=Syncthing,CN=Users,DC=example,DC=com)isn't a useful search filter -- it just says that there should exist a member of that group, but states nothing about the relation between the group and the user logging in. What's the point?Salvoxia commentedon Sep 2, 2023
My scenario is as follows:
LDAP users that are not explicitly granted search privileges cannot see other users.
Since Syncthing performs the search with the user trying to log in instead of an explicit search bind DN, that user can only see itself. So the search filter is only there to ensure correct group membership.
Also, users can bind with user name or mail address, so users can choose whether to log in by user or mail.
The obvious workaround is to use a filter like
(&(|(mail=%s)(cn=%s))(memberOf=CN=Syncthing,CN=Users,DC=example,DC=com))which works just fine, but given the circumstances overcomplicates things.I figured I'd report that abnormal behavior anyway.
Salvoxia commentedon Sep 3, 2023
Correction: It seems that multiple uses of
%sare not supported in the filter, but it must occur exactly once. All following%sare replaced with%!s(MISSING), resulting in a corrupt filter:(&(|([email protected])(cn=%!s(MISSING)))(memberOf=CN=Syncthing,CN=Users,DC=example,DC=com))lib/api: Better handle %s templates in LDAP strings (fixes syncthing#…
Merge branch 'main' into infrastructure
Squashed commit of the following (actually merge upstream/main):
lib/api: Better handle %s templates in LDAP strings (fixes syncthing#…