registry: check for existence of key in regdb_get_secdesc() before proceeding.
[kai/samba.git] / source3 / registry / reg_init_full.c
index ac3f66f1b26e8187d42cee19f3b0fc28a90f6cb7..91e55d76b24f3d77594893e724ea283896caf466 100644 (file)
@@ -62,16 +62,13 @@ REGISTRY_HOOK reg_hooks[] = {
  with all available backens.
  ***********************************************************************/
 
-bool init_registry( void )
+WERROR registry_init_full(void)
 {
        int i;
        WERROR werr;
-       bool ret = false;
 
-       werr = regdb_init();
+       werr = registry_init_common();
        if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(0, ("Failed to initialize the registry: %s\n",
-                         dos_errstr(werr)));
                goto fail;
        }
 
@@ -85,11 +82,11 @@ bool init_registry( void )
 
        /* build the cache tree of registry hooks */
 
-       reghook_cache_init();
-
        for ( i=0; reg_hooks[i].keyname; i++ ) {
-               if (!reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops))
+               werr = reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops);
+               if (!W_ERROR_IS_OK(werr)) {
                        goto fail;
+               }
        }
 
        if ( DEBUGLEVEL >= 20 )
@@ -101,10 +98,8 @@ bool init_registry( void )
        eventlog_init_keys();
        perfcount_init_keys();
 
-       ret = true;
-
 fail:
        /* close and let each smbd open up as necessary */
        regdb_close();
-       return ret;
+       return werr;
 }