1
- .. % $Id: ldap-dn.rst,v 1.8 2016/07/24 15:52:26 stroeder Exp $
1
+ .. % $Id: ldap-dn.rst,v 1.9 2017/08/16 12:00:39 stroeder Exp $
2
2
3
3
4
4
:py:mod: `ldap.dn ` LDAP Distinguished Name handling
27
27
The :mod: `ldap.dn ` module defines the following functions:
28
28
29
29
30
- .. function :: escape_dn_chars(s)
30
+ .. function :: escape_dn_chars(s) -> string
31
31
32
32
This function escapes characters in string *s * which are special in LDAP
33
33
distinguished names. You should use this function when building LDAP DN strings
34
34
from arbitrary input.
35
35
36
- .. % -> string
37
36
38
-
39
- .. function :: str2dn(s [, flags=0])
37
+ .. function :: str2dn(s [, flags=0]) -> list
40
38
41
39
This function takes *s * and breaks it up into its component parts down to AVA
42
40
level. The optional parameter *flags * describes the DN format of s (see
43
41
:ref: `ldap-dn-flags `). Note that hex-encoded non-ASCII chars are decoded
44
42
to the raw bytes.
45
43
46
- .. % -> list
44
+ Internally this function is implemented by calling OpenLDAP C function
45
+ `ldap_str2dn(3) <https://www.openldap.org/software/man.cgi?query=ldap_str2dn&sektion=3 >`_.
47
46
48
47
49
- .. function :: dn2str(dn)
48
+ .. function :: dn2str(dn) -> string
50
49
51
50
This function takes a decomposed DN in *dn * and returns a single string. It's
52
51
the inverse to :func: `str2dn `. Special characters are escaped with the help of
53
52
function :func: `escape_dn_chars `.
54
53
55
- .. % -> string
56
-
57
54
58
- .. function :: explode_dn(dn [, notypes=0[, flags=0]])
55
+ .. function :: explode_dn(dn [, notypes=0[, flags=0]]) -> list
59
56
60
57
This function takes *dn * and breaks it up into its component parts. Each part
61
58
is known as an RDN (Relative Distinguished Name). The optional *notypes *
62
59
parameter is used to specify that only the RDN values be returned and not
63
60
their types. The optional parameter *flags * describes the DN format of s (see
64
- :ref: `ldap-dn-flags `). This function is emulated by function
61
+ :ref: `ldap-dn-flags `). This function is emulated by function
65
62
:func: `str2dn ` since the function ldap_explode_dn() in the C library is
66
63
deprecated.
67
64
68
- .. % -> list
69
-
70
65
71
- .. function :: explode_rdn(rdn [, notypes=0[, flags=0]])
66
+ .. function :: explode_rdn(rdn [, notypes=0[, flags=0]]) -> list
72
67
73
68
This function takes a (multi-valued) *rdn * and breaks it up into a list of
74
69
characteristic attributes. The optional *notypes * parameter is used to specify
@@ -77,14 +72,12 @@ The :mod:`ldap.dn` module defines the following functions:
77
72
function is emulated by function :func: `str2dn ` since the function
78
73
ldap_explode_rdn() in the C library is deprecated.
79
74
80
- .. % -> list
81
75
82
- .. function :: is_dn(dn[, flags=0])
76
+ .. function :: is_dn(dn[, flags=0]) -> boolean
83
77
84
78
This function checks whether *dn * is a valid LDAP distinguished name by
85
79
passing it to function :func: `str2dn `.
86
80
87
- .. % -> boolean
88
81
89
82
.. _ldap-dn-example :
90
83
0 commit comments