summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/dbwrap/dbwrap_tdb.c8
-rw-r--r--source3/lib/messages_local.c21
-rw-r--r--source3/lib/server_mutex.c13
-rw-r--r--source3/lib/serverid.c11
-rw-r--r--source3/smbd/notify_internal.c13
5 files changed, 57 insertions, 9 deletions
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c
index 4330c961ec..e9e4900068 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.c
+++ b/source3/lib/dbwrap/dbwrap_tdb.c
@@ -22,6 +22,7 @@
#include "dbwrap/dbwrap_private.h"
#include "dbwrap/dbwrap_tdb.h"
#include "lib/util/tdb_wrap.h"
+#include "lib/param/param.h"
struct db_tdb_ctx {
struct tdb_wrap *wtdb;
@@ -359,12 +360,14 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
{
struct db_context *result = NULL;
struct db_tdb_ctx *db_tdb;
-
+ struct loadparm_context *lp_ctx;
+
result = talloc_zero(mem_ctx, struct db_context);
if (result == NULL) {
DEBUG(0, ("talloc failed\n"));
goto fail;
}
+ lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
result->private_data = db_tdb = talloc(result, struct db_tdb_ctx);
if (db_tdb == NULL) {
@@ -373,7 +376,8 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
}
db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags,
- open_flags, mode);
+ open_flags, mode, lp_ctx);
+ talloc_unlink(result, lp_ctx);
if (db_tdb->wtdb == NULL) {
DEBUG(3, ("Could not open tdb: %s\n", strerror(errno)));
goto fail;
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)));
diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c
index dc65819197..7ceecfe770 100644
--- a/source3/lib/server_mutex.c
+++ b/source3/lib/server_mutex.c
@@ -22,6 +22,7 @@
#include "system/filesys.h"
#include "lib/util/tdb_wrap.h"
#include "util_tdb.h"
+#include "lib/param/param.h"
/* For reasons known only to MS, many of their NT/Win2k versions
need serialised access only. Two connections at the same time
@@ -46,13 +47,20 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
int timeout)
{
struct named_mutex *result;
-
+ struct loadparm_context *lp_ctx;
result = talloc(mem_ctx, struct named_mutex);
if (result == NULL) {
DEBUG(0, ("talloc failed\n"));
return NULL;
}
+ lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
+ if (lp_ctx == NULL) {
+ DEBUG(0, ("loadparm_init_s3 failed\n"));
+ talloc_free(result);
+ return NULL;
+ }
+
result->name = talloc_strdup(result, name);
if (result->name == NULL) {
DEBUG(0, ("talloc failed\n"));
@@ -61,7 +69,8 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
}
result->tdb = tdb_wrap_open(result, lock_path("mutex.tdb"), 0,
- TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ TDB_DEFAULT, O_RDWR|O_CREAT, 0600, lp_ctx);
+ talloc_unlink(result, lp_ctx);
if (result->tdb == NULL) {
DEBUG(1, ("Could not open mutex.tdb: %s\n",
strerror(errno)));
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index 151d1d605d..b3b294f893 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -24,6 +24,7 @@
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_open.h"
#include "lib/util/tdb_wrap.h"
+#include "lib/param/param.h"
struct serverid_key {
pid_t pid;
@@ -39,6 +40,13 @@ struct serverid_data {
bool serverid_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
@@ -48,7 +56,8 @@ bool serverid_parent_init(TALLOC_CTX *mem_ctx)
db = tdb_wrap_open(mem_ctx, lock_path("serverid.tdb"),
0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT,
- 0644);
+ 0644, lp_ctx);
+ talloc_unlink(mem_ctx, lp_ctx);
if (db == NULL) {
DEBUG(1, ("could not open serverid.tdb: %s\n",
strerror(errno)));
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 4f2749e17d..484a31c5be 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -32,6 +32,7 @@
#include "messages.h"
#include "lib/util/tdb_wrap.h"
#include "util_tdb.h"
+#include "lib/param/param.h"
struct notify_context {
struct db_context *db_recursive;
@@ -137,11 +138,17 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
bool notify_internal_parent_init(TALLOC_CTX *mem_ctx)
{
struct tdb_wrap *db1, *db2;
+ struct loadparm_context *lp_ctx;
if (lp_clustering()) {
return true;
}
+ 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 tdbs in the parent process (smbd) so that our
* CLEAR_IF_FIRST optimization in tdb_reopen_all can properly
@@ -150,13 +157,15 @@ bool notify_internal_parent_init(TALLOC_CTX *mem_ctx)
db1 = tdb_wrap_open(mem_ctx, lock_path("notify.tdb"),
0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
- O_RDWR|O_CREAT, 0644);
+ O_RDWR|O_CREAT, 0644, lp_ctx);
if (db1 == NULL) {
+ talloc_unlink(mem_ctx, lp_ctx);
DEBUG(1, ("could not open notify.tdb: %s\n", strerror(errno)));
return false;
}
db2 = tdb_wrap_open(mem_ctx, lock_path("notify_onelevel.tdb"),
- 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644);
+ 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644, lp_ctx);
+ talloc_unlink(mem_ctx, lp_ctx);
if (db2 == NULL) {
DEBUG(1, ("could not open notify_onelevel.tdb: %s\n",
strerror(errno)));