2007-06-14 15:29:35 +04: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 23:25:36 +04:00
* Software Foundation ; either version 3 of the License , or ( at your option )
2007-06-14 15:29:35 +04: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 09:23:25 +04:00
* this program ; if not , see < http : //www.gnu.org/licenses/>.
2007-06-14 15:29:35 +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:50:54 +04:00
# include "reg_init_smbconf.h"
2007-06-14 15:29:35 +04:00
2007-09-29 03:05:52 +04:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_REGISTRY
2009-03-24 01:14:45 +03:00
extern struct registry_ops smbconf_reg_ops ;
2007-06-14 15:29:35 +04: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 17:25:47 +04:00
WERROR registry_init_smbconf ( const char * keyname )
2007-06-14 15:29:35 +04:00
{
2008-04-13 14:41:34 +04:00
WERROR werr ;
2007-06-14 15:29:35 +04:00
2008-02-15 15:57:31 +03:00
DEBUG ( 10 , ( " registry_init_smbconf called \n " ) ) ;
2007-06-14 15:29:35 +04:00
2008-04-13 14:10:07 +04:00
if ( keyname = = NULL ) {
DEBUG ( 10 , ( " registry_init_smbconf: defaulting to key '%s' \n " ,
KEY_SMBCONF ) ) ;
keyname = KEY_SMBCONF ;
}
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-06-14 15:29:35 +04:00
goto done ;
}
2008-04-13 15:38:44 +04: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 19:19:26 +03:00
keyname , win_errstr ( werr ) ) ) ;
2008-03-20 16:08:29 +03:00
goto done ;
}
2008-04-13 15:38:44 +04:00
2008-04-13 16:55:49 +04: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 19:19:26 +03:00
" %s \n " , win_errstr ( werr ) ) ) ;
2007-06-14 15:29:35 +04:00
goto done ;
}
done :
2008-03-22 03:54:18 +03:00
regdb_close ( ) ;
2008-04-13 17:25:47 +04:00
return werr ;
2007-06-14 15:29:35 +04:00
}