diff options
-rw-r--r-- | source4/scripting/python/samba/netcmd/group.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/group.py b/source4/scripting/python/samba/netcmd/group.py index 265170d2d2..0f4a744acc 100644 --- a/source4/scripting/python/samba/netcmd/group.py +++ b/source4/scripting/python/samba/netcmd/group.py @@ -346,13 +346,16 @@ samba-tool group listmembers \"Domain Users\" -H ldap://samba.samdom.example.com search_filter = "(|(primaryGroupID=%s)(memberOf=%s))" % (rid, group_dn) res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_SUBTREE, expression=(search_filter), - attrs=["samAccountName"]) + attrs=["samAccountName", "cn"]) if (len(res) == 0): return for msg in res: - self.outf.write("%s\n" % msg.get("samAccountName", idx=0)) + member_name = msg.get("samAccountName", idx=0) + if member_name is None: + member_name = msg.get("cn", idx=0) + self.outf.write("%s\n" % member_name) except Exception, e: raise CommandError('Failed to list members of "%s" group ' % groupname, e) |