summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-08-29 18:45:22 +0000
committerGerrit Code Review <review@openstack.org>2019-08-29 18:45:22 +0000
commit9bb6779fbc7244118c6af1e0199e34f9d4417605 (patch)
tree7a1880f8fbba1130385373642cd3dbfc99e85840
parent10a35170420e0033a16e109e979926153d847609 (diff)
parente0507d7ec57f5044727039e2ebc42b29365195c4 (diff)
downloadkeystone-9bb6779fbc7244118c6af1e0199e34f9d4417605.tar.gz
Merge "Fix python3 compatibility on LDAP search DN from id" into stable/rocky
-rw-r--r--keystone/identity/backends/ldap/common.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/keystone/identity/backends/ldap/common.py b/keystone/identity/backends/ldap/common.py
index b873d6e0e..3967aa7ff 100644
--- a/keystone/identity/backends/ldap/common.py
+++ b/keystone/identity/backends/ldap/common.py
@@ -1296,9 +1296,8 @@ class BaseLdap(object):
def _dn_to_id(self, dn):
# 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
- if self.id_attr == utf8_decode(
- ldap.dn.str2dn(utf8_encode(dn))[0][0][0].lower()):
- return utf8_decode(ldap.dn.str2dn(utf8_encode(dn))[0][0][1])
+ if self.id_attr == ldap.dn.str2dn(dn)[0][0][0].lower():
+ return ldap.dn.str2dn(dn)[0][0][1]
else:
# 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.