mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
fix many encoding errors
This commit is contained in:
parent
64e0bba74c
commit
9fb32f11be
@ -186,7 +186,7 @@ class Backend(ldapcherry.backend.backendLdap.Backend):
|
|||||||
'user_dn': self.userdn
|
'user_dn': self.userdn
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
dn = name
|
dn = self._str(name)
|
||||||
|
|
||||||
attrs = {}
|
attrs = {}
|
||||||
|
|
||||||
@ -204,14 +204,14 @@ class Backend(ldapcherry.backend.backendLdap.Backend):
|
|||||||
password = attrs['unicodePwd']
|
password = attrs['unicodePwd']
|
||||||
del(attrs['unicodePwd'])
|
del(attrs['unicodePwd'])
|
||||||
super(Backend, self).add_user(attrs)
|
super(Backend, self).add_user(attrs)
|
||||||
userdn = self._get_user(username, NO_ATTR)
|
self._set_password(attrs['cn'], password)
|
||||||
self._set_password(userdn, password, False)
|
|
||||||
|
|
||||||
def set_attrs(self, username, attrs):
|
def set_attrs(self, username, attrs):
|
||||||
if 'unicodePwd' in attrs:
|
if 'unicodePwd' in attrs:
|
||||||
password = attrs['unicodePwd']
|
password = attrs['unicodePwd']
|
||||||
del(attrs['unicodePwd'])
|
del(attrs['unicodePwd'])
|
||||||
self._set_password(attrs['cn'], password)
|
userdn = self._get_user(self._str(username), NO_ATTR)
|
||||||
|
self._set_password(userdn, password, False)
|
||||||
super(Backend, self).set_attrs(username, attrs)
|
super(Backend, self).set_attrs(username, attrs)
|
||||||
|
|
||||||
def add_to_groups(self, username, groups):
|
def add_to_groups(self, username, groups):
|
||||||
@ -224,7 +224,7 @@ class Backend(ldapcherry.backend.backendLdap.Backend):
|
|||||||
|
|
||||||
def get_groups(self, username):
|
def get_groups(self, username):
|
||||||
username = ldap.filter.escape_filter_chars(username)
|
username = ldap.filter.escape_filter_chars(username)
|
||||||
userdn = self._get_user(username, NO_ATTR)
|
userdn = self._get_user(self._str(username), NO_ATTR)
|
||||||
|
|
||||||
searchfilter = self.group_filter_tmpl % {
|
searchfilter = self.group_filter_tmpl % {
|
||||||
'userdn': userdn,
|
'userdn': userdn,
|
||||||
@ -253,7 +253,7 @@ class Backend(ldapcherry.backend.backendLdap.Backend):
|
|||||||
if binddn is not None:
|
if binddn is not None:
|
||||||
ldap_client = self._connect()
|
ldap_client = self._connect()
|
||||||
try:
|
try:
|
||||||
ldap_client.simple_bind_s(binddn, password)
|
ldap_client.simple_bind_s(self._str(binddn), self._str(password))
|
||||||
except ldap.INVALID_CREDENTIALS:
|
except ldap.INVALID_CREDENTIALS:
|
||||||
ldap_client.unbind_s()
|
ldap_client.unbind_s()
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user