Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support and documentation for "ldapi://" URI scheme #177

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

Zeault
Copy link
Contributor

@Zeault Zeault commented Dec 8, 2024

The existing LDAP code allows an administrator to select the URI scheme used to connect to the LDAP server: either "ldap://" or "ldaps://". However there exists an additional scheme "ldapi://" which was created by the authors of OpenLDAP (See Here). This allows a URI to be constructed that specifies a Unix domain socket to connect to on the filesystem.

Coincidentally, the LDAP client library which pure-ftpd uses is libldap which is part of the OpenLDAP project. The existing pure-ftpd LDAP code simply constructs an LDAP URI string and passes it directly to this library. This almost allows pure-ftpd servers to use the ldapi scheme as-is, but the existing code always appends a port number to the URI and ldapi URIs cannot have port numbers.

This trivial patch simply checks the provided LDAPScheme to see if it is "ldapi" and then omits the port number from the generated URI string. It also adds some documentation to indicate that ldapi URIs will work.

I have been using this patch for a while now and thought it might be worth giving back. Since ldapi URIs are a bit odd, I will provide the first two lines of my actual pure-ftpd.d/ldap.conf file as an example:

LDAPScheme ldapi
LDAPServer %2Frun%2Fopenldap%2Fslapd.socket

@jedisct1
Copy link
Owner

jedisct1 commented Dec 9, 2024

Probably the first time I see a pull request that also includes an update to the documentation! Awesome, thank you!

@jedisct1 jedisct1 merged commit b916ad0 into jedisct1:master Dec 9, 2024
2 checks passed
@Zeault Zeault deleted the ldapi branch December 9, 2024 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants