mirror of
https://github.com/samba-team/samba.git
synced 2025-12-24 04:23:53 +03:00
samba-tool: add -b/--base-dn option to contacts list command
With this option it's e.g. possible to list the contacts of a specify OU or contacts which are located under a different specific place in the AD. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
committed by
Stefan Metzmacher
parent
88f0a1390b
commit
8a45adb2b1
@@ -254,6 +254,9 @@ class cmd_list(Command):
|
||||
type=str,
|
||||
metavar="URL",
|
||||
dest="H"),
|
||||
Option("-b", "--base-dn",
|
||||
help="Specify base DN to use.",
|
||||
type=str),
|
||||
Option("--full-dn",
|
||||
dest="full_dn",
|
||||
default=False,
|
||||
@@ -272,6 +275,7 @@ class cmd_list(Command):
|
||||
credopts=None,
|
||||
versionopts=None,
|
||||
H=None,
|
||||
base_dn=None,
|
||||
full_dn=False):
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp, fallback_machine=True)
|
||||
@@ -281,8 +285,11 @@ class cmd_list(Command):
|
||||
credentials=creds,
|
||||
lp=lp)
|
||||
|
||||
domain_dn = samdb.domain_dn()
|
||||
res = samdb.search(domain_dn,
|
||||
search_dn = samdb.domain_dn()
|
||||
if base_dn:
|
||||
search_dn = samdb.normalize_dn_in_domain(base_dn)
|
||||
|
||||
res = samdb.search(search_dn,
|
||||
scope=ldb.SCOPE_SUBTREE,
|
||||
expression="(objectClass=contact)",
|
||||
attrs=["name"])
|
||||
|
||||
Reference in New Issue
Block a user