From 74e2d6e786974e161949bf49a60404c358d1ecd7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 12 May 2014 10:21:12 +0200 Subject: [PATCH] s3:lib: always use db_open(serverid.tdb) We should not create an empty local serverid.tdb in a cluster setup... Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source3/lib/serverid.c | 49 ++++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index 48b09f71f50..1a7e1edcd4c 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -39,41 +39,6 @@ struct serverid_data { uint32_t msg_flags; }; -bool serverid_parent_init(TALLOC_CTX *mem_ctx) -{ - struct tdb_wrap *db; - struct loadparm_context *lp_ctx; - const char *fname; - - lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers()); - if (lp_ctx == NULL) { - DEBUG(0, ("loadparm_init_s3 failed\n")); - return false; - } - - /* - * Open the tdb in the parent process (smbd) so that our - * CLEAR_IF_FIRST optimization in tdb_reopen_all can properly - * work. - */ - - fname = lock_path("serverid.tdb"); - - db = tdb_wrap_open(mem_ctx, fname, - lpcfg_tdb_hash_size(lp_ctx, fname), - lpcfg_tdb_flags(lp_ctx, - TDB_DEFAULT|TDB_CLEAR_IF_FIRST| - TDB_INCOMPATIBLE_HASH), - O_RDWR|O_CREAT, 0644); - talloc_unlink(mem_ctx, lp_ctx); - if (db == NULL) { - DEBUG(1, ("could not open serverid.tdb: %s\n", - strerror(errno))); - return false; - } - return true; -} - static struct db_context *serverid_db(void) { static struct db_context *db; @@ -88,6 +53,20 @@ static struct db_context *serverid_db(void) return db; } +bool serverid_parent_init(TALLOC_CTX *mem_ctx) +{ + struct tdb_wrap *db; + + db = serverid_db(); + if (db == NULL) { + DEBUG(1, ("could not open serverid.tdb: %s\n", + strerror(errno))); + return false; + } + + return true; +} + static void serverid_fill_key(const struct server_id *id, struct serverid_key *key) { -- 2.11.4.GIT