1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

provision: improve error message when connecting to samdb without the correct permissions

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
This commit is contained in:
Garming Sam 2014-02-05 15:29:18 +13:00 committed by Andrew Bartlett
parent e76bbef8b7
commit b27543aa72

View File

@ -1203,7 +1203,13 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
# And now we can connect to the DB - the schema won't be loaded from the
# DB
samdb.connect(path)
try:
samdb.connect(path)
except ldb.LdbError, (num, string_error):
if (num == ldb.ERR_INSUFFICIENT_ACCESS_RIGHTS):
raise ProvisioningError("Permission denied connecting to %s, are you running as root?" % path)
else:
raise
# But we have to give it one more kick to have it use the schema
# during provision - it needs, now that it is connected, to write