diff options
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 2 | ||||
-rw-r--r-- | source3/registry/reg_init_smbconf.c | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 0ac49a74e5..c53d275938 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -576,7 +576,7 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) } rpd(ctx)->open = false; - if (!registry_init_smbconf()) { + if (!registry_init_smbconf(path)) { werr = WERR_REG_IO_FAILURE; goto done; } diff --git a/source3/registry/reg_init_smbconf.c b/source3/registry/reg_init_smbconf.c index d1acd213c1..ff9cde749e 100644 --- a/source3/registry/reg_init_smbconf.c +++ b/source3/registry/reg_init_smbconf.c @@ -67,13 +67,19 @@ done: * for use in places where not the whole registry is needed, * e.g. utils/net_conf.c and loadparm.c */ -bool registry_init_smbconf(void) +bool registry_init_smbconf(const char *keyname) { bool ret = false; int saved_errno = 0; DEBUG(10, ("registry_init_smbconf called\n")); + if (keyname == NULL) { + DEBUG(10, ("registry_init_smbconf: defaulting to key '%s'\n", + KEY_SMBCONF)); + keyname = KEY_SMBCONF; + } + if (!regdb_init()) { saved_errno = errno; DEBUG(1, ("Can't open the registry")); @@ -83,13 +89,13 @@ bool registry_init_smbconf(void) DEBUGADD(1, (".\n")); goto done; } - if (!init_registry_key(KEY_SMBCONF)) { + if (!init_registry_key(keyname)) { DEBUG(1, ("Could not initialize registry key '%s'\n", - KEY_SMBCONF)); + keyname)); goto done; } reghook_cache_init(); - if (!reghook_cache_add(KEY_SMBCONF, &smbconf_reg_ops)) { + if (!reghook_cache_add(keyname, &smbconf_reg_ops)) { DEBUG(1, ("Error adding smbconf reghooks to reghook cache.\n")); goto done; } |