diff --git a/devpi_ldap/main.py b/devpi_ldap/main.py index 825e174..7f35222 100644 --- a/devpi_ldap/main.py +++ b/devpi_ldap/main.py @@ -175,7 +175,7 @@ def _search(self, conn, config, **kw): search_scope = self._search_scope(config) attribute_name = config['attribute_name'] found = conn.search( - config['base'], search_filter, + config['base'], search_filter.decode("utf8"), search_scope=search_scope, attributes=[attribute_name]) if found: if any(attribute_name in x.get('attributes', {}) for x in conn.response): @@ -218,7 +218,7 @@ def _userdn(self, username): if 'user_template' in self: return self['user_template'].format(username=username) else: - result = self._search(None, self['user_search'], username=username) + result = self._search(None, self['user_search'], username=username.encode("utf8")) if len(result) == 1: return result[0] elif not result: @@ -252,7 +252,7 @@ def validate(self, username, password): config = self.get('group_search', None) if not config: return dict(status="ok") - groups = self._search(conn, config, username=username, userdn=userdn) + groups = self._search(conn, config, username=username, userdn=userdn.encode("utf8")) return dict(status="ok", groups=groups)