registry: separate initialization of registry data from regdb_init().
authorMichael Adam <obnox@samba.org>
Thu, 20 Mar 2008 13:08:29 +0000 (14:08 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 20 Mar 2008 14:01:52 +0000 (15:01 +0100)
Leave this to the users (currently registry_init_smbconf() and
init_registry()) to initialize as much of preliminary registry data
as needed.

Michael

source/registry/reg_backend_db.c
source/registry/reg_init_full.c
source/registry/reg_init_smbconf.c

index e2e908cb84cbeec4059dbb9384cc98f8362ebf41..04b01797f7216a97d7a529dae4e7140850522e26 100644 (file)
@@ -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;
 }
 
index b6a644bb11f6adc3bcd8cc4c587759afd89b3265..5c59c6ba9678ac3ae4f59fa0998bc0188ecf9797 100644 (file)
@@ -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();
index b7e6add1121497141793a5363982f80a98f6a364..1b17852a7a14d9acb41f1978807644403bdb3c71 100644 (file)
@@ -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"));