2002-07-15 22:27:07 +00:00
/*
* Unix SMB / CIFS implementation .
2005-05-23 16:25:31 +00:00
* Virtual Windows Registry Layer
* Copyright ( C ) Gerald Carter 2002 - 2005
2008-01-21 00:32:01 +01:00
* Copyright ( C ) Michael Adam 2008
2002-07-15 22:27:07 +00: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 19:25:36 +00:00
* the Free Software Foundation ; either version 3 of the License , or
2002-07-15 22:27:07 +00: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 05:23:25 +00:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2002-07-15 22:27:07 +00:00
*/
2008-01-21 00:32:01 +01:00
/* Initialize the registry with all available backends. */
2002-07-15 22:27:07 +00:00
# include "includes.h"
2009-10-02 00:17:06 +02:00
# include "registry.h"
2010-05-23 15:25:00 +02:00
# include "reg_cachehook.h"
2010-05-24 22:42:00 +02:00
# include "reg_backend_db.h"
2010-09-21 08:37:14 +02:00
# include "reg_init_basic.h"
2010-09-21 08:45:06 +02:00
# include "reg_init_full.h"
2002-07-15 22:27:07 +00:00
# undef DBGC_CLASS
2007-09-28 23:05:52 +00:00
# define DBGC_CLASS DBGC_REGISTRY
2002-07-15 22:27:07 +00:00
2009-03-23 23:14:45 +01: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-15 22:27:07 +00:00
2009-03-23 23:05:30 +01:00
/* array of registry_hook's which are read into a tree for easy access */
2005-06-29 16:35:32 +00:00
/* #define REG_TDB_ONLY 1 */
2002-07-15 22:27:07 +00:00
2010-05-25 00:31:01 +02:00
struct registry_hook {
const char * keyname ; /* full path to name of key */
struct registry_ops * ops ; /* registry function hooks */
} ;
2009-03-23 23:05:30 +01:00
struct registry_hook reg_hooks [ ] = {
2005-06-29 16:35:32 +00:00
# ifndef REG_TDB_ONLY
2010-04-08 11:26:40 +02:00
{ KEY_PRINTING " \\ Printers " , & printing_ops } ,
{ KEY_PRINTING_2K , & regdb_ops } ,
{ KEY_PRINTING_PORTS , & regdb_ops } ,
2016-10-31 18:07:33 +01:00
{ KEY_PCC , & regdb_ops } ,
2005-05-23 16:25:31 +00:00
{ KEY_SHARES , & shares_reg_ops } ,
2006-11-30 07:38:40 +00:00
{ KEY_SMBCONF , & smbconf_reg_ops } ,
2008-01-18 09:40:42 +01:00
{ KEY_NETLOGON_PARAMS , & netlogon_params_reg_ops } ,
2008-01-18 16:15:43 +01:00
{ KEY_PROD_OPTIONS , & prod_options_reg_ops } ,
2008-01-19 23:46:13 +01:00
{ KEY_TCPIP_PARAMS , & tcpip_params_reg_ops } ,
2008-01-20 01:00:14 +01:00
{ KEY_HKPT , & hkpt_params_reg_ops } ,
2008-01-20 03:24:13 +01:00
{ KEY_CURRENT_VERSION , & current_version_reg_ops } ,
2008-01-20 03:39:27 +01:00
{ KEY_PERFLIB , & perflib_reg_ops } ,
2005-06-29 16:35:32 +00:00
# endif
2002-07-18 23:00:24 +00:00
{ NULL , NULL }
} ;
2002-07-15 22:27:07 +00:00
2002-07-23 04:55:06 +00:00
/***********************************************************************
2009-03-23 23:05:30 +01:00
Open the registry database and initialize the registry_hook cache
2014-11-26 21:34:44 +01:00
with all available backends .
2002-07-23 04:55:06 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2008-03-22 01:53:44 +01:00
2008-04-13 15:33:12 +02:00
WERROR registry_init_full ( void )
2002-07-23 04:55:06 +00:00
{
int i ;
2008-04-13 12:41:34 +02:00
WERROR werr ;
2008-03-22 01:53:44 +01:00
2008-04-13 15:21:31 +02:00
werr = registry_init_common ( ) ;
2008-04-13 12:41:34 +02:00
if ( ! W_ERROR_IS_OK ( werr ) ) {
2007-12-13 22:20:58 +01:00
goto fail ;
2006-12-03 17:16:45 +00:00
}
2006-12-03 17:34:11 +00:00
/* build the cache tree of registry hooks */
2008-03-22 01:53:44 +01:00
2002-07-23 04:55:06 +00:00
for ( i = 0 ; reg_hooks [ i ] . keyname ; i + + ) {
2008-04-13 14:55:49 +02:00
werr = reghook_cache_add ( reg_hooks [ i ] . keyname , reg_hooks [ i ] . ops ) ;
if ( ! W_ERROR_IS_OK ( werr ) ) {
2007-12-13 22:20:58 +01:00
goto fail ;
2008-04-13 14:55:49 +02:00
}
2002-07-23 04:55:06 +00:00
}
if ( DEBUGLEVEL > = 20 )
reghook_dump_cache ( 20 ) ;
2008-03-22 01:53:44 +01:00
fail :
2008-03-22 01:49:21 +01:00
/* close and let each smbd open up as necessary */
regdb_close ( ) ;
2008-04-13 15:31:02 +02:00
return werr ;
2002-07-23 04:55:06 +00:00
}