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). |