1.1.1 Functions

The ldap module defines the following functions:

initialize(uri)
Opens a new connection with an LDAP server, and return an LDAP object (see section 1.3.5) used to perform operations on that server. Parameter uri has to be a valid LDAP URL

open(host [, port=PORT])
Opens a new connection with an LDAP server, and return an LDAP object (see section 1.3.5) used to perform operations on that server. host is a string containing solely the host name. port is an integer specifying the port where the LDAP server is listening (default is 389). Note: Using this function is deprecated.

dn2ufn(dn)
Turns dn into a more user-friendly form, stripping off type names.

explode_dn(dn [, notypes=0])
This function takes dn and breaks it up into its component parts. Each part is known as an RDN (Relative Distinguished Name). The notypes parameter is used to specify that only the RDN values be returned and not their types. For example, the DN "cn=Bob, c=US" would be returned as either ["cn=Bob", "c=US"] or ["Bob","US"] depending on whether notypes was 0 or 1, respectively.

explode_rdn(rdn [, notypes=0])
This function takes a (multi-valued) rdn and breaks it up into a list of characteristic attributes. The notypes parameter is used to specify that only the RDN values be returned and not their types.

is_ldap_url(url)
This function returns true if url `looks like' an LDAP URL (as opposed to some other kind of URL).

get_option(option)
This function returns the value of the global option specified by option.

set_option(option, invalue)
This function sets the value of the global option specified by option to invalue.