[python-ldap] ldap.initialize() URLs must only contain scheme and hostport components: Commas break inside OpenLDAP

Michael Ströder michael at stroeder.com
Wed Aug 16 04:28:31 EDT 2017


Karl Kornel wrote:
> I have a documentation issue that I'd like to report, specific to
> `ldap.initialize()`[1], and the note regarding the URL parameter.

Thanks for spotting this.

> According to OpenLDAP documentation for the `ldap_initialize` function[2]…
> 
>> The uri parameter may be a comma- or whitespace-separated list of URIs containing
>> only the schema, the host, and the port fields.
> 
> So, you can pass `ldap_initialize` a "URL" like this:
> 
>> ldaps://server1:636,ldaps://server2:636

Yes.

> Here's a diff of my proposed changes, for each application:
> -   on that server.  Parameter *uri* has to be a valid LDAP URL.
> +   on that server.  Parameter *uri* has to be a valid LDAP URL containing
> +   *only* the scheme and hostport components.

Hmm, maybe we should just repeat the wording from ldap_initialize(3):

"The uri parameter may be a comma- or whitespace-separated list of URIs containing only
the schema, the host, and the port fields."

> Another option would be to modify `ldap.initialize()` to accept any URL, and then pull
> out only the parts we want.  But that seems like it wouldn't be worth it.

The caller should use ldapurl.LDAPUrl() to parse the full LDAP URL and pass the result of
LDAPUrl.initializeUrl() to ldap.initialize().

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3829 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20170816/c62b8e49/attachment-0001.bin>


More information about the python-ldap mailing list