[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-392-g10ae8ac

Michael Adam ma at sernet.de
Sat Mar 22 01:49:06 GMT 2008


Hi Guenther,

please check these (together with the following fix 
4185ed03a3879ab708b004ef87b9ffaa6a9e6f3d.)

My intention was to remove the registry backend code from libgpo,
leaving only use of reg_api. Since you were only using the regdb
backend as hooks anyways, there is no need to produce another
backend here, if I am not mistaken. Is that right?

Cheers - Michael

Michael Adam wrote:
> The branch, v3-2-test has been updated
>        via  10ae8accb486956ebb1638cee540868a11623b11 (commit)
>        via  4717e6d0cf9df53a55e5d55ede5480181b33920d (commit)
>       from  1831042bdcbfe569ae39177058dfe1d914416513 (commit)
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
> 
> 
> - Log -----------------------------------------------------------------
> commit 10ae8accb486956ebb1638cee540868a11623b11
> Author: Michael Adam <obnox at samba.org>
> Date:   Sat Mar 22 02:29:02 2008 +0100
> 
>     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
> 
> commit 4717e6d0cf9df53a55e5d55ede5480181b33920d
> Author: Michael Adam <obnox at samba.org>
> Date:   Sat Mar 22 02:22:54 2008 +0100
> 
>     libgpo: use reg_setkeysecurity() instead of regdb_set_secdesc().
>     
>     That is, use the reg_api function instead of the backend function.
>     For this, code had to be changed, to take a "struct registry_key"
>     instead of a char *.
>     
>     Michael
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  source/Makefile.in      |    3 +-
>  source/libgpo/gpo_reg.c |   68 +++-------------------------------------------
>  2 files changed, 7 insertions(+), 64 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/source/Makefile.in b/source/Makefile.in
> index 40e792d..19bdad3 100644
> --- a/source/Makefile.in
> +++ b/source/Makefile.in
> @@ -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
>  
> diff --git a/source/libgpo/gpo_reg.c b/source/libgpo/gpo_reg.c
> index 2a27a7e..e48a871 100644
> --- a/source/libgpo/gpo_reg.c
> +++ b/source/libgpo/gpo_reg.c
> @@ -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;
>  	}
>  
> @@ -515,7 +457,7 @@ WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
>  			       token, &reg_ctx);
>  	W_ERROR_NOT_OK_RETURN(werr);
>  
> -	werr = gp_secure_key(mem_ctx, flags, KEY_GROUP_POLICY,
> +	werr = gp_secure_key(mem_ctx, flags, reg_ctx->curr_key,
>  			     &token->user_sids[0]);
>  	if (!W_ERROR_IS_OK(werr)) {
>  		DEBUG(0,("failed to secure key: %s\n", dos_errstr(werr)));
> @@ -806,7 +748,7 @@ static WERROR gp_reg_generate_sd(TALLOC_CTX *mem_ctx,
>  
>  WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
>  		     uint32_t flags,
> -		     const char *key,
> +		     struct registry_key *key,
>  		     const DOM_SID *sid)
>  {
>  	struct security_descriptor *sd = NULL;
> @@ -821,7 +763,7 @@ WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
>  	werr = gp_reg_generate_sd(mem_ctx, sd_sid, &sd, &sd_size);
>  	W_ERROR_NOT_OK_RETURN(werr);
>  
> -	return gp_reg_set_secdesc(key, sd);
> +	return reg_setkeysecurity(key, sd);
>  }
>  
>  /****************************************************************
> @@ -1001,7 +943,7 @@ WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
>  
>  		case GP_REG_ACTION_SEC_KEY_SET:
>  			werr = gp_secure_key(mem_ctx, flags,
> -					     entry->key,
> +					     key,
>  					     &token->user_sids[0]);
>  			if (!W_ERROR_IS_OK(werr)) {
>  				DEBUG(0,("reg_apply_registry_entry: "
> 
> 
> -- 
> Samba Shared Repository

-- 
Michael Adam <ma at sernet.de>  <obnox at samba.org>
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.SerNet.DE, mailto: Info @ SerNet.DE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 206 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20080322/19f54a24/attachment.bin


More information about the samba-technical mailing list