diff --git a/tools/python/jwutils/ldap.py b/tools/python/jwutils/ldap.py index 3d023f0..bbd94ef 100644 --- a/tools/python/jwutils/ldap.py +++ b/tools/python/jwutils/ldap.py @@ -138,7 +138,8 @@ class Connection: # export slog(ERR, f'Failed to delete {dn} ({e})') raise - def walk(self, + def walk( + self, callback: Callable[[Self, Any, Any], None], base: str, scope, @@ -149,7 +150,10 @@ class Connection: # export serverctrls=None, clientctrls=None, timeout=-1, - sizelimit=0): + sizelimit=0, + decode: bool=False, + unroll: bool=False + ): # TODO: Support ignored arguments search_return = self.__ldap.search(base=base, @@ -164,6 +168,10 @@ class Connection: # export if result_type != ldap.RES_SEARCH_ENTRY: continue for entry in result_data: + if decode: + entry = entry[0], {key: [val.decode() for val in vals] for key, vals in entry[1].items()} + if unroll and False: + entry = entry[0], {key: val[0] for key, val in entry[1].items()} try: callback(self, entry, context) except Exception as e: