From 1d591f1ab41209f36ad2c8a076d41c7c2b2728a5 Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Fri, 6 Oct 2017 16:54:49 +0200 Subject: [PATCH] WIP ldap_backend : fix encoding errors during user synchronization (#19168) --- src/authentic2/backends/ldap_backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/authentic2/backends/ldap_backend.py b/src/authentic2/backends/ldap_backend.py index 80f1baa7..b190c5e4 100644 --- a/src/authentic2/backends/ldap_backend.py +++ b/src/authentic2/backends/ldap_backend.py @@ -300,6 +300,7 @@ class LDAPBackend(object): _TO_LOWERCASE = ('fname_field', 'lname_field', 'email_field', 'attributes', 'mandatory_attributes_values') _VALID_CONFIG_KEYS = list(set(_REQUIRED).union(set(_DEFAULTS))) + _DN_SUBELEMENTS = ('basedn', 'user_basedn', 'group_basedn', 'user_dn') @classmethod @to_list @@ -319,6 +320,9 @@ class LDAPBackend(object): # First get our configuration into a standard format for block in blocks: cls.update_default(block) + for dn_subelement in cls._DN_SUBELEMENTS: + if isinstance(block.get(dn_subelement), unicode): + block[dn_subelement] = block[dn_subelement].encode('utf-8') log.debug('got config %r', blocks) return blocks -- 2.11.0