diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-11-09 13:27:20 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-11-10 14:24:21 +1100 |
commit | 862823a7764c692282dec7a93e7d37feeb924eef (patch) | |
tree | e63805927bd961bc242b8d0906dd35f4182b05e6 /source4/scripting | |
parent | 39356761e5b7090851de2e909f471265f94d34be (diff) | |
download | samba-862823a7764c692282dec7a93e7d37feeb924eef.tar.gz samba-862823a7764c692282dec7a93e7d37feeb924eef.tar.bz2 samba-862823a7764c692282dec7a93e7d37feeb924eef.zip |
samba-tool: print samaccountname in samba-tool user list
this is the attribute the admin needs for other commands
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/netcmd/user.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py index 1d84a3391c..23c7515259 100644 --- a/source4/scripting/python/samba/netcmd/user.py +++ b/source4/scripting/python/samba/netcmd/user.py @@ -208,15 +208,12 @@ class cmd_user_list(Command): res = samdb.search(domain_dn, scope=ldb.SCOPE_SUBTREE, expression=("(&(objectClass=user)(userAccountControl:%s:=%u))" % (ldb.OID_COMPARATOR_AND, dsdb.UF_NORMAL_ACCOUNT)), - attrs=["name"]) + attrs=["samaccountname"]) if (len(res) == 0): return - try: - for msg in res: - self.outf.write("%s\n" % msg["name"][0]) - except Exception, msg: - raise CommandError("Failed to get user list: %s" % msg) + for msg in res: + self.outf.write("%s\n" % msg.get("samaccountname", idx=0)) class cmd_user_enable(Command): |