diff options
author | Andrew Bartlett <abartlet@samba.org> | 2014-02-05 14:52:28 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2014-02-05 08:42:25 +0100 |
commit | 673d41503c6e391337df1b86e49108d58f1af6bd (patch) | |
tree | 5800479146de58bf1f302d6aceaf0a2946e6588a | |
parent | a89060a0217f8740798d1dac4466222301a4d81b (diff) | |
download | samba-673d41503c6e391337df1b86e49108d58f1af6bd.tar.gz samba-673d41503c6e391337df1b86e49108d58f1af6bd.tar.xz samba-673d41503c6e391337df1b86e49108d58f1af6bd.zip |
ldb: Return LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS rather than OPERATIONS_ERROR on EACCES and EPERM
This makes provision errors clearer in Samba.
Andrew Bartlett
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
-rw-r--r-- | lib/ldb/ldb_tdb/ldb_tdb.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index 30c58f5ee3..d3c83f5d57 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1560,10 +1560,13 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url, ldb_get_create_perms(ldb), ldb); if (!ltdb->tdb) { ldb_asprintf_errstring(ldb, - "Unable to open tdb '%s'", path); + "Unable to open tdb '%s': %s", path, strerror(errno)); ldb_debug(ldb, LDB_DEBUG_ERROR, - "Unable to open tdb '%s'", path); + "Unable to open tdb '%s': %s", path, strerror(errno)); talloc_free(ltdb); + if (errno == EACCES || errno == EPERM) { + return LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS; + } return LDB_ERR_OPERATIONS_ERROR; } |