2004-12-10 20:07:04 +00:00
/*
Unix SMB / CIFS implementation .
Copyright ( C ) Jelmer Vernooij 2004.
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 Software Foundation ; either version 2 of the License , or
( 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
along with this program ; if not , write to the Free Software
Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
# include "includes.h"
# include "registry.h"
2006-03-06 10:09:53 +00:00
/**
* @ file
* @ brief Samba - specific registry functions
*/
2005-02-10 05:09:35 +00:00
static WERROR reg_samba_get_predef ( struct registry_context * ctx , uint32_t hkey , struct registry_key * * k )
2004-12-10 20:07:04 +00:00
{
WERROR error ;
const char * conf ;
2005-08-08 03:19:28 +00:00
char * backend ;
const char * location ;
2004-12-11 20:06:40 +00:00
const char * hivename = reg_get_predef_name ( hkey ) ;
2004-12-10 20:07:04 +00:00
* k = NULL ;
conf = lp_parm_string ( - 1 , " registry " , hivename ) ;
if ( ! conf ) {
return WERR_NOT_SUPPORTED ;
}
2005-08-08 03:19:28 +00:00
location = strchr ( conf , ' : ' ) ;
2004-12-10 20:07:04 +00:00
if ( location ) {
2005-08-08 03:19:28 +00:00
backend = talloc_strndup ( ctx , conf , ( int ) ( location - conf ) ) ;
2004-12-10 20:07:04 +00:00
location + + ;
2005-08-08 03:19:28 +00:00
} else {
backend = talloc_strdup ( ctx , " ldb " ) ;
location = conf ;
2004-12-10 20:07:04 +00:00
}
2004-12-11 20:06:40 +00:00
/* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
* and HKEY_CURRENT_USER \ Software \ Classes */
/* FIXME: HKEY_CURRENT_CONFIG is an alias for HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current */
/* FIXME: HKEY_PERFORMANCE_DATA is dynamically generated */
/* FIXME: HKEY_LOCAL_MACHINE\Hardware is autogenerated */
/* FIXME: HKEY_LOCAL_MACHINE\Security\SAM is an alias for HKEY_LOCAL_MACHINE\SAM */
2004-12-10 20:07:04 +00:00
error = reg_open_hive ( ctx , backend , location , NULL , k ) ;
2005-01-27 07:08:20 +00:00
talloc_free ( backend ) ;
2004-12-10 20:07:04 +00:00
return error ;
}
2006-03-05 17:15:19 +00:00
_PUBLIC_ WERROR reg_open_local ( struct registry_context * * ctx )
2004-12-10 20:07:04 +00:00
{
2005-01-27 07:08:20 +00:00
* ctx = talloc ( NULL , struct registry_context ) ;
2004-12-11 20:06:40 +00:00
( * ctx ) - > get_predefined_key = reg_samba_get_predef ;
2004-12-10 20:07:04 +00:00
return WERR_OK ;
}