From: Andrew Bartlett Date: Thu, 18 Oct 2018 03:50:19 +0000 (+1300) Subject: join: Avoid searching for more than strictly required during sanity check X-Git-Tag: tdb-1.3.17~1295 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30277feb839f7460638c777b048e45d557dfdea0;p=thirdparty%2Fsamba.git 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 Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/join.py b/python/samba/join.py index 6a9c3b9807f..75106ff52fa 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -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())