1 | /*
|
---|
2 | * Unix SMB/CIFS implementation.
|
---|
3 | * Virtual Windows Registry Layer
|
---|
4 | * Copyright (C) Gerald Carter 2002-2005
|
---|
5 | * Copyright (C) Michael Adam 2008
|
---|
6 | *
|
---|
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.
|
---|
11 | *
|
---|
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.
|
---|
16 | *
|
---|
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/>.
|
---|
19 | */
|
---|
20 |
|
---|
21 | /* Initialize the registry with all available backends. */
|
---|
22 |
|
---|
23 | #include "includes.h"
|
---|
24 |
|
---|
25 | #undef DBGC_CLASS
|
---|
26 | #define DBGC_CLASS DBGC_REGISTRY
|
---|
27 |
|
---|
28 | extern REGISTRY_OPS printing_ops;
|
---|
29 | extern REGISTRY_OPS eventlog_ops;
|
---|
30 | extern REGISTRY_OPS shares_reg_ops;
|
---|
31 | extern REGISTRY_OPS smbconf_reg_ops;
|
---|
32 | extern REGISTRY_OPS netlogon_params_reg_ops;
|
---|
33 | extern REGISTRY_OPS prod_options_reg_ops;
|
---|
34 | extern REGISTRY_OPS tcpip_params_reg_ops;
|
---|
35 | extern REGISTRY_OPS hkpt_params_reg_ops;
|
---|
36 | extern REGISTRY_OPS current_version_reg_ops;
|
---|
37 | extern REGISTRY_OPS perflib_reg_ops;
|
---|
38 | extern REGISTRY_OPS regdb_ops; /* these are the default */
|
---|
39 |
|
---|
40 | /* array of REGISTRY_HOOK's which are read into a tree for easy access */
|
---|
41 | /* #define REG_TDB_ONLY 1 */
|
---|
42 |
|
---|
43 | REGISTRY_HOOK reg_hooks[] = {
|
---|
44 | #ifndef REG_TDB_ONLY
|
---|
45 | { KEY_PRINTING, &printing_ops },
|
---|
46 | { KEY_PRINTING_2K, &printing_ops },
|
---|
47 | { KEY_PRINTING_PORTS, &printing_ops },
|
---|
48 | { KEY_SHARES, &shares_reg_ops },
|
---|
49 | { KEY_SMBCONF, &smbconf_reg_ops },
|
---|
50 | { KEY_NETLOGON_PARAMS, &netlogon_params_reg_ops },
|
---|
51 | { KEY_PROD_OPTIONS, &prod_options_reg_ops },
|
---|
52 | { KEY_TCPIP_PARAMS, &tcpip_params_reg_ops },
|
---|
53 | { KEY_HKPT, &hkpt_params_reg_ops },
|
---|
54 | { KEY_CURRENT_VERSION, ¤t_version_reg_ops },
|
---|
55 | { KEY_PERFLIB, &perflib_reg_ops },
|
---|
56 | #endif
|
---|
57 | { NULL, NULL }
|
---|
58 | };
|
---|
59 |
|
---|
60 | /***********************************************************************
|
---|
61 | Open the registry database and initialize the REGISTRY_HOOK cache
|
---|
62 | with all available backens.
|
---|
63 | ***********************************************************************/
|
---|
64 |
|
---|
65 | WERROR registry_init_full(void)
|
---|
66 | {
|
---|
67 | int i;
|
---|
68 | WERROR werr;
|
---|
69 |
|
---|
70 | werr = registry_init_common();
|
---|
71 | if (!W_ERROR_IS_OK(werr)) {
|
---|
72 | goto fail;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /* setup the necessary keys and values */
|
---|
76 |
|
---|
77 | werr = init_registry_data();
|
---|
78 | if (!W_ERROR_IS_OK(werr)) {
|
---|
79 | DEBUG(0, ("Failed to initialize data in registry!\n"));
|
---|
80 | goto fail;
|
---|
81 | }
|
---|
82 |
|
---|
83 | /* build the cache tree of registry hooks */
|
---|
84 |
|
---|
85 | for ( i=0; reg_hooks[i].keyname; i++ ) {
|
---|
86 | werr = reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops);
|
---|
87 | if (!W_ERROR_IS_OK(werr)) {
|
---|
88 | goto fail;
|
---|
89 | }
|
---|
90 | }
|
---|
91 |
|
---|
92 | if ( DEBUGLEVEL >= 20 )
|
---|
93 | reghook_dump_cache(20);
|
---|
94 |
|
---|
95 | /* add any keys for other services */
|
---|
96 |
|
---|
97 | svcctl_init_keys();
|
---|
98 | eventlog_init_keys();
|
---|
99 | perfcount_init_keys();
|
---|
100 |
|
---|
101 | fail:
|
---|
102 | /* close and let each smbd open up as necessary */
|
---|
103 | regdb_close();
|
---|
104 | return werr;
|
---|
105 | }
|
---|