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"
2009-10-02 02:17:06 +04:00
# include "registry.h"
2010-05-23 17:25:00 +04:00
# include "reg_cachehook.h"
2010-05-25 00:42:00 +04:00
# include "reg_backend_db.h"
2010-09-21 10:37:14 +04:00
# include "reg_init_basic.h"
2010-09-21 10:45:06 +04:00
# include "reg_init_full.h"
2002-07-16 02:27:07 +04:00
# 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
2010-05-25 02:31:01 +04:00
struct registry_hook {
const char * keyname ; /* full path to name of key */
struct registry_ops * ops ; /* registry function hooks */
} ;
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
2010-04-08 13:26:40 +04:00
{ KEY_PRINTING " \\ Printers " , & printing_ops } ,
{ KEY_PRINTING_2K , & regdb_ops } ,
{ KEY_PRINTING_PORTS , & regdb_ops } ,
2016-10-31 20:07:33 +03:00
{ KEY_PCC , & regdb_ops } ,
2005-05-23 20:25:31 +04:00
{ 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
2014-11-26 23:34:44 +03:00
with all available backends .
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 ) ;
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
}