diff options
author | Jule Anger <ja@sernet.de> | 2019-08-12 20:46:47 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2020-01-21 14:38:45 +0000 |
commit | 8f68236dc4ed281098d534981521d22a250e4001 (patch) | |
tree | 8a4ac1eb1929b130ace3060c89b4da32b8db2dd5 /python | |
parent | b545ab1a85d56f169eecfa5d8735fdc5dd5a83f4 (diff) | |
download | samba-8f68236dc4ed281098d534981521d22a250e4001.tar.gz |
samba-tool: add -b/--base-dn option to groups list command
With this option it's e.g. possible to list the groups of a
specify OU or groups which are located under a different specific
place in the AD.
Signed-off-by: Jule Anger <ja@sernet.de>
Pair-programmed-with: Björn Baumbach <bb@samba.org>
Reviewed-by: Björn Baumbach <bb@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/netcmd/group.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/python/samba/netcmd/group.py b/python/samba/netcmd/group.py index ac3dbd9bb02..2e1db1371b4 100644 --- a/python/samba/netcmd/group.py +++ b/python/samba/netcmd/group.py @@ -313,6 +313,9 @@ class cmd_group_list(Command): Option("-v", "--verbose", help="Verbose output, showing group type and group scope.", action="store_true"), + Option("-b", "--base-dn", + help="Specify base DN to use.", + type=str), Option("--full-dn", dest="full_dn", default=False, action='store_true', @@ -331,6 +334,7 @@ class cmd_group_list(Command): versionopts=None, H=None, verbose=False, + base_dn=None, full_dn=False): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) @@ -342,6 +346,8 @@ class cmd_group_list(Command): if verbose: attrs += ["grouptype", "member"] domain_dn = samdb.domain_dn() + if base_dn: + domain_dn = samdb.normalize_dn_in_domain(base_dn) res = samdb.search(domain_dn, scope=ldb.SCOPE_SUBTREE, expression=("(objectClass=group)"), attrs=attrs) |