ldap3.utils.dn module


Escape rdn characters to prevent injection according to RFC 4514.

ldap3.utils.dn.parse_dn(dn, escape=False, strip=True)
ldap3.utils.dn.safe_dn(dn, decompose=False, reverse=False)

normalize and escape a dn, if dn is a sequence it is joined. the reverse parameter changes the join direction of the sequence

ldap3.utils.dn.safe_rdn(dn, decompose=False)

Returns a list of rdn for the dn, usually there is only one rdn, but it can be more than one when the + sign is used

ldap3.utils.dn.to_dn(iterator, decompose=False, remove_space=False, space_around_equal=False, separate_rdn=False)

Convert an iterator to a list of dn parts if decompose=True return a list of tuple (one for each dn component) else return a list of strings if remove_space=True removes unneeded spaces if space_around_equal=True add spaces around equal in returned strings if separate_rdn=True consider multiple RDNs as different component of DN