mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
libgpo: replace hand-crafted registry initialization by registry_init_basic.
IMO there is no need to imitate a custom registry backend. Only default regdb hooks are used here, so a plain initialization of regdb should suffice. This way, only reg_api is used in libgpo, and no registry backend code is visible. Michael
This commit is contained in:
parent
4717e6d0cf
commit
10ae8accb4
@ -388,7 +388,7 @@ LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/gpo_ini.o libgpo/gpo_util.o \
|
||||
libgpo/gpo_fetch.o libgpo/gpo_filesync.o libgpo/gpo_sec.o \
|
||||
libgpo/gpo_reg.o \
|
||||
$(GPEXT_OBJ)
|
||||
LIBGPO_OBJ = $(LIBGPO_OBJ0)
|
||||
LIBGPO_OBJ = $(LIBGPO_OBJ0) $(REG_INIT_BASIC_OBJ)
|
||||
|
||||
LIBADS_OBJ = libads/ldap.o libads/ldap_printer.o \
|
||||
libads/sasl.o libads/sasl_wrapping.o \
|
||||
@ -451,6 +451,7 @@ LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
|
||||
UTIL_REG_OBJ = lib/util_reg.o
|
||||
UTIL_REG_API_OBJ = lib/util_reg_api.o
|
||||
|
||||
REG_INIT_BASIC_OBJ = registry/reg_init_basic.o
|
||||
REG_INIT_SMBCONF_OBJ = registry/reg_init_smbconf.o
|
||||
REG_INIT_FULL_OBJ = registry/reg_init_full.o
|
||||
|
||||
|
@ -20,53 +20,6 @@
|
||||
#include "includes.h"
|
||||
|
||||
|
||||
extern REGISTRY_OPS regdb_ops;
|
||||
|
||||
static int gp_reg_fetch_keys(const char *key, REGSUBKEY_CTR *subkey_ctr)
|
||||
{
|
||||
return regdb_ops.fetch_subkeys(key, subkey_ctr);
|
||||
}
|
||||
|
||||
static bool gp_reg_store_keys(const char *key, REGSUBKEY_CTR *subkeys)
|
||||
{
|
||||
return regdb_ops.store_subkeys(key, subkeys);
|
||||
}
|
||||
|
||||
static int gp_reg_fetch_values(const char *key, REGVAL_CTR *val)
|
||||
{
|
||||
return regdb_ops.fetch_values(key, val);
|
||||
}
|
||||
|
||||
static bool gp_reg_store_values(const char *key, REGVAL_CTR *val)
|
||||
{
|
||||
return regdb_ops.store_values(key, val);
|
||||
}
|
||||
|
||||
static WERROR gp_reg_get_secdesc(TALLOC_CTX *mem_ctx, const char *key,
|
||||
struct security_descriptor **psecdesc)
|
||||
{
|
||||
return regdb_ops.get_secdesc(mem_ctx, key, psecdesc);
|
||||
}
|
||||
|
||||
static WERROR gp_reg_set_secdesc(const char *key,
|
||||
struct security_descriptor *secdesc)
|
||||
{
|
||||
return regdb_ops.set_secdesc(key, secdesc);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
****************************************************************/
|
||||
|
||||
static REGISTRY_OPS gp_reg_ops = {
|
||||
.fetch_subkeys = gp_reg_fetch_keys,
|
||||
.fetch_values = gp_reg_fetch_values,
|
||||
.store_subkeys = gp_reg_store_keys,
|
||||
.store_values = gp_reg_store_values,
|
||||
/* .reg_access_check = gp_reg_reg_access_check, */
|
||||
.get_secdesc = gp_reg_get_secdesc,
|
||||
.set_secdesc = gp_reg_set_secdesc
|
||||
};
|
||||
|
||||
/****************************************************************
|
||||
****************************************************************/
|
||||
|
||||
@ -101,24 +54,13 @@ WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
|
||||
struct gp_registry_context **reg_ctx)
|
||||
{
|
||||
struct gp_registry_context *tmp_ctx;
|
||||
static REGISTRY_HOOK gp_reg_hook;
|
||||
WERROR werr;
|
||||
|
||||
if (!reg_ctx) {
|
||||
return WERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!regdb_init()) {
|
||||
return WERR_CAN_NOT_COMPLETE;
|
||||
}
|
||||
|
||||
gp_reg_hook.keyname = initial_path; /* KEY_SAMBA_GROUP_POLICY */
|
||||
gp_reg_hook.ops = &gp_reg_ops;
|
||||
|
||||
/* not sure about the cache hook */
|
||||
reghook_cache_init();
|
||||
|
||||
if (!reghook_cache_add(&gp_reg_hook)) {
|
||||
if (!registry_init_basic()) {
|
||||
return WERR_CAN_NOT_COMPLETE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user