Method Protocols.LDAP.get_connection()
- Method
get_connection
objectget_connection(stringldap_url,void|stringbinddn,void|stringpassword,void|intversion,void|SSL.Contextctx)- Description
Returns a client connection to the specified LDAP URL. If a bind DN is specified (either through a
"bindname"extension inldap_urlor, if there isn't one, throughbinddn) then the connection will be bound using that DN and the optional password. If no bind DN is given then any connection is returned, regardless of the bind DN it is using.versionmay be used to specify the required protocol version in the bind operation. If zero or left out, a bind attempt with the default version (currently3) is done with a fallback to2if that fails. Also, a cached connection for any version might be returned ifversionisn't specified.ctxmay be specified to control SSL/TLS parameters to use with the"ldaps"-protocol. Note that changing this only affects new connections.As opposed to creating an Protocols.LDAP.client instance directly, this function can return an already established connection for the same URL, provided connections are given back using return_connection when they aren't used anymore.
A client object with an error condition is returned if there's a bind error, e.g. invalid password.