mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +01:00
improve robustness if user dn attribute contains something like ,cn=
This commit is contained in:
parent
d820cceeb6
commit
7f00264e32
@ -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
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user