mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
samba-tool: tidy up uncaught insufficient rights LdbError
It is likely that many sub-commands will produce a traceback when people go `-H ldap://server -Ubob` when they needed to go `-UAdministrator`. We can catch these and show only the core message. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
ee94d70855
commit
ccfa16e2ec
@ -23,7 +23,7 @@ import textwrap
|
||||
import traceback
|
||||
|
||||
import samba
|
||||
from ldb import ERR_INVALID_CREDENTIALS, LdbError
|
||||
from ldb import ERR_INVALID_CREDENTIALS, ERR_INSUFFICIENT_ACCESS_RIGHTS, LdbError
|
||||
from samba import colour
|
||||
from samba.auth import system_session
|
||||
from samba.getopt import Option, OptionParser
|
||||
@ -242,6 +242,9 @@ class Command(object):
|
||||
elif ldb_emsg.startswith("Unable to open tdb "):
|
||||
self._print_error(message, ldb_emsg, 'ldb')
|
||||
force_traceback = False
|
||||
elif ldb_ecode == ERR_INSUFFICIENT_ACCESS_RIGHTS:
|
||||
self._print_error("User has insufficient access rights")
|
||||
force_traceback = False
|
||||
else:
|
||||
self._print_error(message, ldb_emsg, 'ldb')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user