diff options
author | Amit Kumar <amitkuma@redhat.com> | 2019-06-28 04:51:57 +0530 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-10-17 09:21:20 +0000 |
commit | aacbd383b9e843b5d36b91ef75f6f2d2724a438b (patch) | |
tree | 38821858dba06c924e1735cf06d25905450c9ca3 /python/samba/netcmd | |
parent | 6bd2f0e9c4da1cad10a778da0c86e14d69ad5036 (diff) | |
download | samba-aacbd383b9e843b5d36b91ef75f6f2d2724a438b.tar.gz |
samba-tool: Update 'samba-tool gpo list <>' description
We have a command to get gpo listing from Active Directory.
samba-tool gpo list <username>
This command can list GPOs for both username and machinename,
But command help only shows 'username'.
This PR
- Updates the option presented in help.
- Updates name of variable used to retrieve GPO so that it's
not misleading if someone reads code later on
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14016
Signed-off-by: Amit Kumar <amitkuma@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Oct 17 09:21:20 UTC 2019 on sn-devel-184
Diffstat (limited to 'python/samba/netcmd')
-rw-r--r-- | python/samba/netcmd/gpo.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 047f91951e8..106c5cf2d56 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -478,9 +478,9 @@ class cmd_listall(GPOCommand): class cmd_list(GPOCommand): """List GPOs for an account.""" - synopsis = "%prog <username> [options]" + synopsis = "%prog <username|machinename> [options]" - takes_args = ['username'] + takes_args = ['accountname'] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, @@ -492,7 +492,7 @@ class cmd_list(GPOCommand): type=str, metavar="URL", dest="H") ] - def run(self, username, H=None, sambaopts=None, credopts=None, versionopts=None): + def run(self, accountname, H=None, sambaopts=None, credopts=None, versionopts=None): self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp, fallback_machine=True) @@ -503,17 +503,17 @@ class cmd_list(GPOCommand): try: msg = self.samdb.search(expression='(&(|(samAccountName=%s)(samAccountName=%s$))(objectClass=User))' % - (ldb.binary_encode(username), ldb.binary_encode(username))) + (ldb.binary_encode(accountname), ldb.binary_encode(accountname))) user_dn = msg[0].dn except Exception: - raise CommandError("Failed to find account %s" % username) + raise CommandError("Failed to find account %s" % accountname) # check if its a computer account try: msg = self.samdb.search(base=user_dn, scope=ldb.SCOPE_BASE, attrs=['objectClass'])[0] is_computer = 'computer' in msg['objectClass'] except Exception: - raise CommandError("Failed to find objectClass for user %s" % username) + raise CommandError("Failed to find objectClass for %s" % accountname) session_info_flags = (AUTH_SESSION_INFO_DEFAULT_GROUPS | AUTH_SESSION_INFO_AUTHENTICATED) @@ -587,7 +587,7 @@ class cmd_list(GPOCommand): else: msg_str = 'user' - self.outf.write("GPOs for %s %s\n" % (msg_str, username)) + self.outf.write("GPOs for %s %s\n" % (msg_str, accountname)) for g in gpos: self.outf.write(" %s %s\n" % (g[0], g[1])) |