s3:registry: extract the reg_util prototypes into their own header.
[Samba/ekacnet.git] / source3 / registry / reg_init_full.c
blobf211112ce3bddba04e5a926f48ef1f5282fba1f9
1 /*
2 * Unix SMB/CIFS implementation.
3 * Virtual Windows Registry Layer
4 * Copyright (C) Gerald Carter 2002-2005
5 * Copyright (C) Michael Adam 2008
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 /* Initialize the registry with all available backends. */
23 #include "includes.h"
24 #include "registry.h"
25 #include "reg_cachehook.h"
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_REGISTRY
30 extern struct registry_ops printing_ops;
31 extern struct registry_ops eventlog_ops;
32 extern struct registry_ops shares_reg_ops;
33 extern struct registry_ops smbconf_reg_ops;
34 extern struct registry_ops netlogon_params_reg_ops;
35 extern struct registry_ops prod_options_reg_ops;
36 extern struct registry_ops tcpip_params_reg_ops;
37 extern struct registry_ops hkpt_params_reg_ops;
38 extern struct registry_ops current_version_reg_ops;
39 extern struct registry_ops perflib_reg_ops;
40 extern struct registry_ops regdb_ops; /* these are the default */
42 /* array of registry_hook's which are read into a tree for easy access */
43 /* #define REG_TDB_ONLY 1 */
45 struct registry_hook reg_hooks[] = {
46 #ifndef REG_TDB_ONLY
47 { KEY_PRINTING, &printing_ops },
48 { KEY_PRINTING_2K, &printing_ops },
49 { KEY_PRINTING_PORTS, &printing_ops },
50 { KEY_SHARES, &shares_reg_ops },
51 { KEY_SMBCONF, &smbconf_reg_ops },
52 { KEY_NETLOGON_PARAMS, &netlogon_params_reg_ops },
53 { KEY_PROD_OPTIONS, &prod_options_reg_ops },
54 { KEY_TCPIP_PARAMS, &tcpip_params_reg_ops },
55 { KEY_HKPT, &hkpt_params_reg_ops },
56 { KEY_CURRENT_VERSION, &current_version_reg_ops },
57 { KEY_PERFLIB, &perflib_reg_ops },
58 #endif
59 { NULL, NULL }
62 /***********************************************************************
63 Open the registry database and initialize the registry_hook cache
64 with all available backens.
65 ***********************************************************************/
67 WERROR registry_init_full(void)
69 int i;
70 WERROR werr;
72 werr = registry_init_common();
73 if (!W_ERROR_IS_OK(werr)) {
74 goto fail;
77 /* build the cache tree of registry hooks */
79 for ( i=0; reg_hooks[i].keyname; i++ ) {
80 werr = reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops);
81 if (!W_ERROR_IS_OK(werr)) {
82 goto fail;
86 if ( DEBUGLEVEL >= 20 )
87 reghook_dump_cache(20);
89 /* add any keys for other services */
91 svcctl_init_keys();
92 eventlog_init_keys();
93 perfcount_init_keys();
95 fail:
96 /* close and let each smbd open up as necessary */
97 regdb_close();
98 return werr;