diff options
Diffstat (limited to 'source3/lib/serverid.c')
-rw-r--r-- | source3/lib/serverid.c | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index 48b09f71f5..1a7e1edcd4 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) { |