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

fix modify for empty attributes

This commit is contained in:
kakwa 2015-07-14 14:20:31 +02:00
parent 3587afcbfa
commit afb3c0ef23

View File

@ -658,17 +658,17 @@ class LdapCherry(object):
if pwd1 in params['attrs']: if pwd1 in params['attrs']:
if params['attrs'][pwd1] != params['attrs'][pwd2]: if params['attrs'][pwd1] != params['attrs'][pwd2]:
raise PasswordMissMatch() raise PasswordMissMatch()
if not self._checkppolicy(params['attrs'][pwd1])['match']: if params['attrs'][pwd1] != '' and \
not self._checkppolicy(params['attrs'][pwd1])['match']:
raise PPolicyError() raise PPolicyError()
params['attrs'][attr] = params['attrs'][pwd1] params['attrs'][attr] = params['attrs'][pwd1]
if attr in params['attrs']: if attr in params['attrs'] and params['attrs'][attr] != '':
self.attributes.check_attr(attr, params['attrs'][attr]) self.attributes.check_attr(attr, params['attrs'][attr])
backends = self.attributes.get_backends_attributes(attr) backends = self.attributes.get_backends_attributes(attr)
for b in backends: for b in backends:
if b not in badd: if b not in badd:
badd[b] = {} badd[b] = {}
if params['attrs'][attr] != '': badd[b][backends[b]] = params['attrs'][attr]
badd[b][backends[b]] = params['attrs'][attr]
for b in badd: for b in badd:
self.backends[b].set_attrs(username, badd[b]) self.backends[b].set_attrs(username, badd[b])
return badd return badd