py3: get_effective_rights: values passed to ldap must be bytes

Values passed to LDAP must be bytes

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Martin Basti 2017-01-13 12:37:47 +01:00
parent dd3d9f1ca6
commit 49333058c8

View File

@ -289,7 +289,10 @@ class ldap2(CrudBackend, LDAPClient):
principal = getattr(context, 'principal')
entry = self.find_entry_by_attr("krbprincipalname", principal,
"krbPrincipalAux", base_dn=self.api.env.basedn)
sctrl = [GetEffectiveRightsControl(True, "dn: " + str(entry.dn))]
sctrl = [
GetEffectiveRightsControl(
True, "dn: {0}".format(entry.dn).encode('utf-8'))
]
self.conn.set_option(_ldap.OPT_SERVER_CONTROLS, sctrl)
try:
entry = self.get_entry(dn, attrs_list)