From bbe8849a654ed0764e1834f24d1837df41a79881 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mon, 9 Jan 2017 19:01:29 +0100 Subject: [PATCH] py3: ldap modlist must have keys as string, not bytes https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Christian Heimes Reviewed-By: Jan Cholasta --- ipapython/ipaldap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index 3ee40bf71..57f7dc1cb 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -887,7 +887,8 @@ class LDAPClient(object): elif isinstance(val, tuple): return tuple(self.encode(m) for m in val) elif isinstance(val, dict): - dct = dict((self.encode(k), self.encode(v)) for k, v in val.items()) + # key in dict must be str not bytes + dct = dict((k, self.encode(v)) for k, v in val.items()) return dct elif isinstance(val, datetime.datetime): return val.strftime(LDAP_GENERALIZED_TIME_FORMAT)