From 2f01e055cf0a8d49f1d732f03c7d2bebd8e123ae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 20 Mar 2008 14:08:29 +0100 Subject: registry: separate initialization of registry data from regdb_init(). Leave this to the users (currently registry_init_smbconf() and init_registry()) to initialize as much of preliminary registry data as needed. Michael (This used to be commit 59fdd30c789ccfd5cff356e459f1653b065b985c) --- source3/registry/reg_backend_db.c | 11 ++--------- source3/registry/reg_init_full.c | 7 +++++++ source3/registry/reg_init_smbconf.c | 5 +++++ 3 files changed, 14 insertions(+), 9 deletions(-) (limited to 'source3/registry') diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index e2e908cb84..04b01797f7 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -183,7 +183,7 @@ fail: * create each component key of the specified path, * wrapped in one db transaction. */ -static bool init_registry_key(const char *add_path) +bool init_registry_key(const char *add_path) { if (regdb->transaction_start(regdb) == -1) { DEBUG(0, ("init_registry_key: transaction_start failed\n")); @@ -213,7 +213,7 @@ fail: Open the registry data in the tdb ***********************************************************************/ -static bool init_registry_data(void) +bool init_registry_data(void) { TALLOC_CTX *frame = NULL; REGVAL_CTR *values; @@ -351,13 +351,6 @@ bool regdb_init( void ) vers_id, REGVER_V1)); } - /* always setup the necessary keys and values */ - - if ( !init_registry_data() ) { - DEBUG(0,("regdb_init: Failed to initialize data in registry!\n")); - return false; - } - return true; } diff --git a/source3/registry/reg_init_full.c b/source3/registry/reg_init_full.c index b6a644bb11..5c59c6ba96 100644 --- a/source3/registry/reg_init_full.c +++ b/source3/registry/reg_init_full.c @@ -74,6 +74,13 @@ bool init_registry( void ) goto fail; } + /* setup the necessary keys and values */ + + if ( !init_registry_data() ) { + DEBUG(0,("regdb_init: Failed to initialize data in registry!\n")); + return false; + } + /* build the cache tree of registry hooks */ reghook_cache_init(); diff --git a/source3/registry/reg_init_smbconf.c b/source3/registry/reg_init_smbconf.c index b7e6add112..1b17852a7a 100644 --- a/source3/registry/reg_init_smbconf.c +++ b/source3/registry/reg_init_smbconf.c @@ -84,6 +84,11 @@ bool registry_init_smbconf(void) DEBUGADD(1, (".\n")); goto done; } + if (!init_registry_key(KEY_SMBCONF)) { + DEBUG(1, ("Could not initialize registry key '%s'\n", + KEY_SMBCONF)); + goto done; + } reghook_cache_init(); if (!reghook_cache_add(&smbconf_reg_hook)) { DEBUG(1, ("Error adding smbconf reghooks to reghook cache.\n")); -- cgit