summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/ldb/common/ldb.c11
-rw-r--r--source3/lib/ldb/include/ldb.h1
-rw-r--r--source3/lib/ldb/include/ldb_private.h2
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_tdb.c3
4 files changed, 16 insertions, 1 deletions
diff --git a/source3/lib/ldb/common/ldb.c b/source3/lib/ldb/common/ldb.c
index b54febf208..28d1c7235a 100644
--- a/source3/lib/ldb/common/ldb.c
+++ b/source3/lib/ldb/common/ldb.c
@@ -52,6 +52,7 @@ struct ldb_context *ldb_init(void *mem_ctx)
}
ldb_set_utf8_default(ldb);
+ ldb_set_create_perms(ldb, 0666);
return ldb;
}
@@ -455,6 +456,16 @@ int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *o
return LDB_SUCCESS;
}
+
+/*
+ set the permissions for new files to be passed to open() in
+ backends that use local files
+ */
+void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms)
+{
+ ldb->create_perms = perms;
+}
+
/*
start an ldb request
NOTE: the request must be a talloc context.
diff --git a/source3/lib/ldb/include/ldb.h b/source3/lib/ldb/include/ldb.h
index 0761280d90..d2f3bd53d3 100644
--- a/source3/lib/ldb/include/ldb.h
+++ b/source3/lib/ldb/include/ldb.h
@@ -781,6 +781,7 @@ int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type);
int ldb_set_timeout(struct ldb_context *ldb, struct ldb_request *req, int timeout);
int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *oldreq, struct ldb_request *newreq);
+void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms);
/**
Initialise ldbs' global information
diff --git a/source3/lib/ldb/include/ldb_private.h b/source3/lib/ldb/include/ldb_private.h
index 96b71ff3b4..3cacd5e292 100644
--- a/source3/lib/ldb/include/ldb_private.h
+++ b/source3/lib/ldb/include/ldb_private.h
@@ -119,6 +119,8 @@ struct ldb_context {
int default_timeout;
unsigned int flags;
+
+ unsigned int create_perms;
};
#ifndef ARRAY_SIZE
diff --git a/source3/lib/ldb/ldb_tdb/ldb_tdb.c b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
index 9b502b5911..608120e3a7 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -1042,7 +1042,8 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
/* note that we use quite a large default hash size */
ltdb->tdb = ltdb_wrap_open(ltdb, path, 10000,
- tdb_flags, open_flags, 0644, ldb);
+ tdb_flags, open_flags,
+ ldb->create_perms, ldb);
if (!ltdb->tdb) {
ldb_debug(ldb, LDB_DEBUG_ERROR, "Unable to open tdb '%s'\n", path);
talloc_free(ltdb);