1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

join: Avoid searching for more than strictly required during sanity check

We check for the default base DN as this does require authentication, but
we do not need to search for more than just that (so use SCOPE_BASE) and
we need no attributes, so ask for none

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2018-10-18 16:50:19 +13:00
parent d8ea16a3fb
commit 30277feb83

View File

@ -112,9 +112,9 @@ class DCJoinContext(object):
ctx.site = DEFAULTSITE
try:
ctx.samdb.search(scope=ldb.SCOPE_ONELEVEL, attrs=["dn"])
except ldb.LdbError as e4:
(enum, estr) = e4.args
ctx.samdb.search(scope=ldb.SCOPE_BASE, attrs=[])
except ldb.LdbError as e:
(enum, estr) = e.args
raise DCJoinException(estr)
ctx.base_dn = str(ctx.samdb.get_default_basedn())