1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-29 15:42:04 +03:00

samba-tool ldapcmp: use CommandError on auth failure

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall
2022-08-18 11:53:29 +12:00
committed by Douglas Bagnall
parent 960ae819ad
commit 2cdafb9431

View File

@ -108,8 +108,13 @@ class LDAPBase(object):
return [str(x["cn"][0]) for x in res]
def find_netbios(self):
res = self.ldb.search(base="CN=Partitions,%s" % self.config_dn,
scope=SCOPE_SUBTREE, attrs=["nETBIOSName"])
try:
res = self.ldb.search(base="CN=Partitions,%s" % self.config_dn,
scope=SCOPE_SUBTREE, attrs=["nETBIOSName"])
except LdbError as e:
enum, estr = e
if estr in ["Operation unavailable without authentication"]:
raise CommandError(estr, e)
if len(res) == 0:
raise CommandError("Could not find netbios name")