1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-12-22 21:00:04 +01:00

improve robustness if user dn attribute contains something like ,cn=

This commit is contained in:
kakwa 2016-07-31 12:21:26 +02:00
parent d820cceeb6
commit 7f00264e32
2 changed files with 6 additions and 4 deletions

View File

@ -311,7 +311,9 @@ class Backend(ldapcherry.backend.Backend):
dn = \
self._str(self.dn_user_attr) + \
'=' + \
self._str(attrs[self.dn_user_attr]) + \
ldap.dn.escape_dn_chars(
self._str(attrs[self.dn_user_attr])
) + \
',' + \
self._str(self.userdn)
# gen the ldif fir add_s and add the user

View File

@ -172,12 +172,12 @@ class TestError(object):
def testAddUser(self):
try:
inv.del_user(u'test☭')
inv.del_user(u'test☭,cn=')
except:
pass
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
user = {
'uid': u'test☭',
'uid': u'test☭,cn=',
'sn': u'test☭',
'cn': u'test☭',
'userPassword': u'test☭',
@ -186,7 +186,7 @@ class TestError(object):
'homeDirectory': '/home/test/'
}
inv.add_user(user)
inv.del_user(u'test☭')
inv.del_user(u'test☭,cn=')
def testModifyUser(self):
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')