2002-07-16 02:27:07 +04:00
/*
* Unix SMB / CIFS implementation .
2005-05-23 20:25:31 +04:00
* Virtual Windows Registry Layer
* Copyright ( C ) Gerald Carter 2002 - 2005
2008-01-21 02:32:01 +03:00
* Copyright ( C ) Michael Adam 2008
2002-07-16 02:27:07 +04:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
* the Free Software Foundation ; either version 3 of the License , or
2002-07-16 02:27:07 +04:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2007-07-10 09:23:25 +04:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2002-07-16 02:27:07 +04:00
*/
2008-01-21 02:32:01 +03:00
/* Initialize the registry with all available backends. */
2002-07-16 02:27:07 +04:00
# include "includes.h"
# undef DBGC_CLASS
2007-09-29 03:05:52 +04:00
# define DBGC_CLASS DBGC_REGISTRY
2002-07-16 02:27:07 +04:00
2009-03-24 01:14:45 +03:00
extern struct registry_ops printing_ops ;
extern struct registry_ops eventlog_ops ;
extern struct registry_ops shares_reg_ops ;
extern struct registry_ops smbconf_reg_ops ;
extern struct registry_ops netlogon_params_reg_ops ;
extern struct registry_ops prod_options_reg_ops ;
extern struct registry_ops tcpip_params_reg_ops ;
extern struct registry_ops hkpt_params_reg_ops ;
extern struct registry_ops current_version_reg_ops ;
extern struct registry_ops perflib_reg_ops ;
extern struct registry_ops regdb_ops ; /* these are the default */
2002-07-16 02:27:07 +04:00
2009-03-24 01:05:30 +03:00
/* array of registry_hook's which are read into a tree for easy access */
2005-06-29 20:35:32 +04:00
/* #define REG_TDB_ONLY 1 */
2002-07-16 02:27:07 +04:00
2009-03-24 01:05:30 +03:00
struct registry_hook reg_hooks [ ] = {
2005-06-29 20:35:32 +04:00
# ifndef REG_TDB_ONLY
2005-05-23 20:25:31 +04:00
{ KEY_PRINTING , & printing_ops } ,
{ KEY_PRINTING_2K , & printing_ops } ,
{ KEY_PRINTING_PORTS , & printing_ops } ,
{ KEY_SHARES , & shares_reg_ops } ,
2006-11-30 10:38:40 +03:00
{ KEY_SMBCONF , & smbconf_reg_ops } ,
2008-01-18 11:40:42 +03:00
{ KEY_NETLOGON_PARAMS , & netlogon_params_reg_ops } ,
2008-01-18 18:15:43 +03:00
{ KEY_PROD_OPTIONS , & prod_options_reg_ops } ,
2008-01-20 01:46:13 +03:00
{ KEY_TCPIP_PARAMS , & tcpip_params_reg_ops } ,
2008-01-20 03:00:14 +03:00
{ KEY_HKPT , & hkpt_params_reg_ops } ,
2008-01-20 05:24:13 +03:00
{ KEY_CURRENT_VERSION , & current_version_reg_ops } ,
2008-01-20 05:39:27 +03:00
{ KEY_PERFLIB , & perflib_reg_ops } ,
2005-06-29 20:35:32 +04:00
# endif
2002-07-19 03:00:24 +04:00
{ NULL , NULL }
} ;
2002-07-16 02:27:07 +04:00
2002-07-23 08:55:06 +04:00
/***********************************************************************
2009-03-24 01:05:30 +03:00
Open the registry database and initialize the registry_hook cache
2008-01-21 02:32:01 +03:00
with all available backens .
2002-07-23 08:55:06 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2008-03-22 03:53:44 +03:00
2008-04-13 17:33:12 +04:00
WERROR registry_init_full ( void )
2002-07-23 08:55:06 +04:00
{
int i ;
2008-04-13 14:41:34 +04:00
WERROR werr ;
2008-03-22 03:53:44 +03:00
2008-04-13 17:21:31 +04:00
werr = registry_init_common ( ) ;
2008-04-13 14:41:34 +04:00
if ( ! W_ERROR_IS_OK ( werr ) ) {
2007-12-14 00:20:58 +03:00
goto fail ;
2006-12-03 20:16:45 +03:00
}
2006-12-03 20:34:11 +03:00
/* build the cache tree of registry hooks */
2008-03-22 03:53:44 +03:00
2002-07-23 08:55:06 +04:00
for ( i = 0 ; reg_hooks [ i ] . keyname ; i + + ) {
2008-04-13 16:55:49 +04:00
werr = reghook_cache_add ( reg_hooks [ i ] . keyname , reg_hooks [ i ] . ops ) ;
if ( ! W_ERROR_IS_OK ( werr ) ) {
2007-12-14 00:20:58 +03:00
goto fail ;
2008-04-13 16:55:49 +04:00
}
2002-07-23 08:55:06 +04:00
}
if ( DEBUGLEVEL > = 20 )
reghook_dump_cache ( 20 ) ;
2005-10-06 21:48:03 +04:00
/* add any keys for other services */
2005-09-30 21:13:37 +04:00
svcctl_init_keys ( ) ;
2005-10-06 21:48:03 +04:00
eventlog_init_keys ( ) ;
2005-11-08 19:33:45 +03:00
perfcount_init_keys ( ) ;
2005-09-30 21:13:37 +04:00
2008-03-22 03:53:44 +03:00
fail :
2008-03-22 03:49:21 +03:00
/* close and let each smbd open up as necessary */
regdb_close ( ) ;
2008-04-13 17:31:02 +04:00
return werr ;
2002-07-23 08:55:06 +04:00
}