summaryrefslogtreecommitdiff
path: root/source3/lib/messages_local.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-12 23:01:08 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-13 14:06:07 +0200
commit01c934c81e55b79601122d8e0740c7946077c37e (patch)
treef6e7909690bc399c3036ef80e22997aadbf88884 /source3/lib/messages_local.c
parent3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c (diff)
downloadsamba-01c934c81e55b79601122d8e0740c7946077c37e.tar.gz
samba-01c934c81e55b79601122d8e0740c7946077c37e.tar.bz2
samba-01c934c81e55b79601122d8e0740c7946077c37e.zip
lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these parameters to be checked. This may be s3 or s4 context, allowing the #if _SAMBA_BUILD_ macro to go away safely. Andrew Bartlett
Diffstat (limited to 'source3/lib/messages_local.c')
-rw-r--r--source3/lib/messages_local.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index 67234d4d76..9b4e3c5e43 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -46,6 +46,7 @@
#include "system/filesys.h"
#include "messages.h"
#include "lib/util/tdb_wrap.h"
+#include "lib/param/param.h"
struct messaging_tdb_context {
struct messaging_context *msg_ctx;
@@ -86,12 +87,19 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
{
struct messaging_backend *result;
struct messaging_tdb_context *ctx;
+ struct loadparm_context *lp_ctx;
if (!(result = talloc(mem_ctx, struct messaging_backend))) {
DEBUG(0, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY;
}
+ lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
+ if (lp_ctx == NULL) {
+ DEBUG(0, ("loadparm_init_s3 failed\n"));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
ctx = talloc_zero(result, struct messaging_tdb_context);
if (!ctx) {
DEBUG(0, ("talloc failed\n"));
@@ -105,7 +113,8 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
ctx->tdb = tdb_wrap_open(ctx, lock_path("messages.tdb"), 0,
TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH,
- O_RDWR|O_CREAT,0600);
+ O_RDWR|O_CREAT,0600, lp_ctx);
+ talloc_unlink(result, lp_ctx);
if (!ctx->tdb) {
NTSTATUS status = map_nt_error_from_unix(errno);
@@ -137,6 +146,13 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx)
{
struct tdb_wrap *db;
+ struct loadparm_context *lp_ctx;
+
+ lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
+ if (lp_ctx == NULL) {
+ DEBUG(0, ("loadparm_init_s3 failed\n"));
+ return false;
+ }
/*
* Open the tdb in the parent process (smbd) so that our
@@ -146,7 +162,8 @@ bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx)
db = tdb_wrap_open(mem_ctx, lock_path("messages.tdb"), 0,
TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE|TDB_INCOMPATIBLE_HASH,
- O_RDWR|O_CREAT,0600);
+ O_RDWR|O_CREAT,0600, lp_ctx);
+ talloc_unlink(mem_ctx, lp_ctx);
if (db == NULL) {
DEBUG(1, ("could not open messaging.tdb: %s\n",
strerror(errno)));