fix DN encoding in search_s
[matthijs/upstream/django-ldapdb.git] / ldapdb / __init__.py
index c8c56eda8704e34532b4db35b0433849b8ee5922..c622eb31491f65d618a2f3b6e9bd596ebb147b41 100644 (file)
@@ -62,13 +62,15 @@ class LdapConnection(object):
 
     def search_s(self, base, scope, filterstr, attrlist):
         results = self.connection.search_s(base, scope, filterstr.encode(self.charset), attrlist)
+        output = []
         for dn, attrs in results:
             for field in attrs:
                 if field == "member" or field == "memberUid":
                     attrs[field] = convert(field, attrs[field], lambda x: x.decode(self.charset))
                 else:
                     attrs[field] = convert(field, attrs[field][0], lambda x: x.decode(self.charset))
-        return results
+            output.append((dn.decode(self.charset), attrs))
+        return output
 
 # FIXME: is this the right place to initialize the LDAP connection?
 connection = LdapConnection(settings.LDAPDB_SERVER_URI,