2007-06-14 11:29:35 +00:00
/*
* Unix SMB / CIFS implementation .
* Registry helper routines
* Copyright ( C ) Michael Adam 2007
*
* 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 the Free
2007-07-09 19:25:36 +00:00
* Software Foundation ; either version 3 of the License , or ( at your option )
2007-06-14 11:29:35 +00:00
* 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 along with
2007-07-10 05:23:25 +00:00
* this program ; if not , see < http : //www.gnu.org/licenses/>.
2007-06-14 11:29:35 +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:50:54 +02:00
# include "reg_init_smbconf.h"
2007-06-14 11:29:35 +00:00
2007-09-28 23:05:52 +00:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_REGISTRY
2009-03-23 23:14:45 +01:00
extern struct registry_ops smbconf_reg_ops ;
2007-06-14 11:29:35 +00:00
/*
* init the smbconf portion of the registry .
* for use in places where not the whole registry is needed ,
* e . g . utils / net_conf . c and loadparm . c
*/
2008-04-13 15:25:47 +02:00
WERROR registry_init_smbconf ( const char * keyname )
2007-06-14 11:29:35 +00:00
{
2008-04-13 12:41:34 +02:00
WERROR werr ;
2007-06-14 11:29:35 +00:00
2008-02-15 13:57:31 +01:00
DEBUG ( 10 , ( " registry_init_smbconf called \n " ) ) ;
2007-06-14 11:29:35 +00:00
2008-04-13 12:10:07 +02:00
if ( keyname = = NULL ) {
DEBUG ( 10 , ( " registry_init_smbconf: defaulting to key '%s' \n " ,
KEY_SMBCONF ) ) ;
keyname = KEY_SMBCONF ;
}
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-06-14 11:29:35 +00:00
goto done ;
}
2008-04-13 13:38:44 +02:00
werr = init_registry_key ( keyname ) ;
if ( ! W_ERROR_IS_OK ( werr ) ) {
DEBUG ( 1 , ( " Failed to initialize registry key '%s': %s \n " ,
2008-11-01 17:19:26 +01:00
keyname , win_errstr ( werr ) ) ) ;
2008-03-20 14:08:29 +01:00
goto done ;
}
2008-04-13 13:38:44 +02:00
2008-04-13 14:55:49 +02:00
werr = reghook_cache_add ( keyname , & smbconf_reg_ops ) ;
if ( ! W_ERROR_IS_OK ( werr ) ) {
DEBUG ( 1 , ( " Failed to add smbconf reghooks to reghook cache: "
2008-11-01 17:19:26 +01:00
" %s \n " , win_errstr ( werr ) ) ) ;
2007-06-14 11:29:35 +00:00
goto done ;
}
done :
2008-03-22 01:54:18 +01:00
regdb_close ( ) ;
2008-04-13 15:25:47 +02:00
return werr ;
2007-06-14 11:29:35 +00:00
}