From 6122aa423f26d02336547034e920fe1000234599 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Baumbach?= Date: Wed, 26 Feb 2020 13:38:50 +0100 Subject: [PATCH] samba-tool group listmembers: use binary encoded group names MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Allows to find groups with names like e.g. 'group1 (xy)'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett (cherry picked from commit d0f8e833653df652df01a472c4bbfd256f10f810) --- python/samba/netcmd/group.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/samba/netcmd/group.py b/python/samba/netcmd/group.py index 5c608732ec3..db06a72bb73 100644 --- a/python/samba/netcmd/group.py +++ b/python/samba/netcmd/group.py @@ -401,7 +401,8 @@ samba-tool group listmembers \"Domain Users\" -H ldap://samba.samdom.example.com samdb = SamDB(url=H, session_info=system_session(), credentials=creds, lp=lp) - search_filter = "(&(objectClass=group)(samaccountname=%s))" % groupname + search_filter = ("(&(objectClass=group)(sAMAccountName=%s))" % + ldb.binary_encode(groupname)) try: res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE, expression=(search_filter), -- 2.11.4.GIT