From ad4a09cf767537b06d880a2249cb7e392dd84fe7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 5 Feb 2014 14:52:28 +1300 Subject: 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 Signed-off-by: Andrew Bartlett Reviewed-by: Jelmer Vernooij (cherry picked from commit 673d41503c6e391337df1b86e49108d58f1af6bd) --- lib/ldb/ldb_tdb/ldb_tdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/ldb/ldb_tdb/ldb_tdb.c') diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index 30c58f5ee36..d3c83f5d579 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; } -- cgit v1.2.1