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

Karl Kornel akkornel at stanford.edu
Wed Aug 16 04:47:25 EDT 2017

On Wednesday, August 16, 2017 at 1:28 AM, Michael Ströder said:

> <<<snip>>>

> > 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."

I think that would be fine, with one note: For ReconnectLDAPObject, I think it should note what the behavior is when you initialize it with multiple URLs.  For example, would it only try to reconnect to the initial URL that is used, or would it re-try all URLs?

> > 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().

Ah, I was not aware of that method!  I don't see it mentioned anywhere in the online ldapurl module documentation, so I didn't know it was there.

> Ciao, Michael.

Thanks very much!

~ Karl

More information about the python-ldap mailing list