lib/util: add function to query the monotonic clock with the required fallback to...
[Samba/gbeck.git] / source3 / registry / reg_init_smbconf.c
blobf8110495575b21daa661be7b9dd45661ee3b952b
1 /*
2 * Unix SMB/CIFS implementation.
3 * Registry helper routines
4 * Copyright (C) Michael Adam 2007
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 3 of the License, or (at your option)
9 * any later version.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "registry.h"
22 #include "reg_cachehook.h"
23 #include "reg_backend_db.h"
25 #undef DBGC_CLASS
26 #define DBGC_CLASS DBGC_REGISTRY
28 extern struct registry_ops smbconf_reg_ops;
31 * init the smbconf portion of the registry.
32 * for use in places where not the whole registry is needed,
33 * e.g. utils/net_conf.c and loadparm.c
35 WERROR registry_init_smbconf(const char *keyname)
37 WERROR werr;
39 DEBUG(10, ("registry_init_smbconf called\n"));
41 if (keyname == NULL) {
42 DEBUG(10, ("registry_init_smbconf: defaulting to key '%s'\n",
43 KEY_SMBCONF));
44 keyname = KEY_SMBCONF;
47 werr = registry_init_common();
48 if (!W_ERROR_IS_OK(werr)) {
49 goto done;
52 werr = init_registry_key(keyname);
53 if (!W_ERROR_IS_OK(werr)) {
54 DEBUG(1, ("Failed to initialize registry key '%s': %s\n",
55 keyname, win_errstr(werr)));
56 goto done;
59 werr = reghook_cache_add(keyname, &smbconf_reg_ops);
60 if (!W_ERROR_IS_OK(werr)) {
61 DEBUG(1, ("Failed to add smbconf reghooks to reghook cache: "
62 "%s\n", win_errstr(werr)));
63 goto done;
66 done:
67 regdb_close();
68 return werr;