Merge "Fix python3 compatibility on LDAP search DN from id" into stable/rocky
This commit is contained in:
commit
9bb6779fbc
|
@ -1296,9 +1296,8 @@ class BaseLdap(object):
|
||||||
def _dn_to_id(self, dn):
|
def _dn_to_id(self, dn):
|
||||||
# Check if the naming attribute in the DN is the same as keystone's
|
# Check if the naming attribute in the DN is the same as keystone's
|
||||||
# configured 'id' attribute'. If so, extract the ID value from the DN
|
# configured 'id' attribute'. If so, extract the ID value from the DN
|
||||||
if self.id_attr == utf8_decode(
|
if self.id_attr == ldap.dn.str2dn(dn)[0][0][0].lower():
|
||||||
ldap.dn.str2dn(utf8_encode(dn))[0][0][0].lower()):
|
return ldap.dn.str2dn(dn)[0][0][1]
|
||||||
return utf8_decode(ldap.dn.str2dn(utf8_encode(dn))[0][0][1])
|
|
||||||
else:
|
else:
|
||||||
# The 'ID' attribute is NOT in the DN, so we need to perform an
|
# The 'ID' attribute is NOT in the DN, so we need to perform an
|
||||||
# LDAP search to look it up from the user entry itself.
|
# LDAP search to look it up from the user entry itself.
|
||||||
|
|
Loading…
Reference in New Issue