@@ -85,6 +85,15 @@ class LDAPDistinguishedName_Escaping(TestCaseWithKnownValues):
85
85
86
86
(r'cn=bar\ ' , [[('cn' , r'bar ' )]]),
87
87
88
+ (r'cn=test+owner=uid\=foo\,ou\=depar'
89
+ + r'tment\,dc\=example\,dc\=com,dc=ex'
90
+ + r'ample,dc=com' , [[('cn' , r'test' ),
91
+ ('owner' , r'uid=foo,ou=depart'
92
+ + r'ment,dc=example,dc=com' ),
93
+ ],
94
+ [('dc' , r'example' )],
95
+ [('dc' , r'com' )]]),
96
+
88
97
(r'cn=bar,dc=example,dc=com' , [[('cn' , 'bar' )],
89
98
[('dc' , 'example' )],
90
99
[('dc' , 'com' )]]),
@@ -97,6 +106,25 @@ class LDAPDistinguishedName_Escaping(TestCaseWithKnownValues):
97
106
98
107
)
99
108
109
+ def testOpenLDAPEqualsEscape (self ):
110
+ """Slapd wants = to be escaped in RDN attributeValues."""
111
+ got = dn .DistinguishedName (listOfRDNs = [
112
+ dn .RelativeDistinguishedName (
113
+ attributeTypesAndValues = [
114
+ dn .LDAPAttributeTypeAndValue (attributeType = 'cn' , value = r'test' ),
115
+ dn .LDAPAttributeTypeAndValue (attributeType = 'owner' , value = r'uid=foo,ou=depart'
116
+ + r'ment,dc=example,dc=com' ),
117
+ ]),
118
+
119
+ dn .RelativeDistinguishedName ('dc=example' ),
120
+ dn .RelativeDistinguishedName ('dc=com' ),
121
+ ])
122
+ got = str (got )
123
+ self .assertEquals (got ,
124
+ r'cn=test+owner=uid\=foo\,ou\=depar'
125
+ + r'tment\,dc\=example\,dc\=com,dc=ex'
126
+ + r'ample,dc=com' )
127
+
100
128
class LDAPDistinguishedName_RFC2253_Examples (TestCaseWithKnownValues ):
101
129
knownValues = (
102
130
0 commit comments