summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-13 12:10:07 +0200
committerMichael Adam <obnox@samba.org>2008-04-13 15:33:47 +0200
commitbcb19766d6c18b847b0576ea86c0a0e468af78af (patch)
tree4513b7e8c23641978b1e52c9cacbba247c396c87 /source3/registry
parent2c47a6a7106081a8fbc7f9f971518c8cf28ad3b9 (diff)
downloadsamba-bcb19766d6c18b847b0576ea86c0a0e468af78af.tar.gz
samba-bcb19766d6c18b847b0576ea86c0a0e468af78af.tar.bz2
samba-bcb19766d6c18b847b0576ea86c0a0e468af78af.zip
registry: make registry_init_smbconf() hook the registry ops onto given key.
This still defaults to HKLM\Software\Samba\smbconf, but is interchangeable now. This allows us to open the libsmbconf registry backend on different registry keys. Michael (This used to be commit 8fe1a2f567afbecbe487f08825cb43b038065e99)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_init_smbconf.c14
1 files changed, 10 insertions, 4 deletions
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;
}