1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 18:54:29 +01:00

more encoding fixes

This commit is contained in:
kakwa 2015-07-29 00:09:15 +02:00
parent 3391ed9704
commit 69700d0ce9

View File

@ -233,7 +233,7 @@ class Backend(ldapcherry.backend.Backend):
user_filter = self.user_filter_tmpl % { user_filter = self.user_filter_tmpl % {
'username': username 'username': username
} }
user_filter = self._str(user_filter)
r = self._search(user_filter, attrs, self.userdn) r = self._search(user_filter, attrs, self.userdn)
if len(r) == 0: if len(r) == 0:
@ -246,9 +246,13 @@ class Backend(ldapcherry.backend.Backend):
return dn_entry return dn_entry
def _str(self, s): def _str(self, s):
if s is None:
return None
return s.encode('utf-8') return s.encode('utf-8')
def _uni(self, s): def _uni(self, s):
if s is None:
return None
return s.decode('utf-8', 'ignore') return s.decode('utf-8', 'ignore')
def auth(self, username, password): def auth(self, username, password):