server/ldaputils.py
changeset 8917 685b93559e33
parent 8906 ed35d984ff28
child 8918 43fd866e8f8a
equal deleted inserted replaced
8916:2a424950463d 8917:685b93559e33
   340                 # we only support ldap_salted_sha1 for ldap sources, see: server/utils.py
   340                 # we only support ldap_salted_sha1 for ldap sources, see: server/utils.py
   341                 if not value.startswith('{SSHA}'):
   341                 if not value.startswith('{SSHA}'):
   342                     value = utils.crypt_password(value)
   342                     value = utils.crypt_password(value)
   343                 itemdict[key] = Binary(value)
   343                 itemdict[key] = Binary(value)
   344             else:
   344             else:
   345                 for i, val in enumerate(value):
   345                 value = [unicode(val, 'utf-8', 'replace') for val in value]
   346                     value[i] = unicode(val, 'utf-8', 'replace')
   346                 if len(value) == 1:
   347                 if isinstance(value, list) and len(value) == 1:
       
   348                     itemdict[key] = value = value[0]
   347                     itemdict[key] = value = value[0]
       
   348                 else:
       
   349                     itemdict[key] = value
   349         return itemdict
   350         return itemdict
   350 
   351 
   351     def _process_no_such_object(self, session, dn):
   352     def _process_no_such_object(self, session, dn):
   352         """Some search return NO_SUCH_OBJECT error, handle this (usually because
   353         """Some search return NO_SUCH_OBJECT error, handle this (usually because
   353         an object whose dn is no more existent in ldap as been encountered).
   354         an object whose dn is no more existent in ldap as been encountered).