mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:registry: replace typedef REGISTRY_KEY by struct registry_key_handle
Michael
This commit is contained in:
parent
8797bb1382
commit
cec8428747
@ -4859,20 +4859,25 @@ void reghook_dump_cache( int debuglevel );
|
||||
|
||||
/* The following definitions come from registry/reg_dispatcher.c */
|
||||
|
||||
bool store_reg_keys( REGISTRY_KEY *key, struct regsubkey_ctr *subkeys );
|
||||
bool store_reg_values(REGISTRY_KEY *key, struct regval_ctr *val);
|
||||
WERROR create_reg_subkey(REGISTRY_KEY *key, const char *subkey);
|
||||
WERROR delete_reg_subkey(REGISTRY_KEY *key, const char *subkey);
|
||||
int fetch_reg_keys( REGISTRY_KEY *key, struct regsubkey_ctr *subkey_ctr );
|
||||
int fetch_reg_values(REGISTRY_KEY *key, struct regval_ctr *val);
|
||||
bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted,
|
||||
const struct nt_user_token *token );
|
||||
WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
|
||||
bool store_reg_keys(struct registry_key_handle *key,
|
||||
struct regsubkey_ctr *subkeys);
|
||||
bool store_reg_values(struct registry_key_handle *key, struct regval_ctr *val);
|
||||
WERROR create_reg_subkey(struct registry_key_handle *key, const char *subkey);
|
||||
WERROR delete_reg_subkey(struct registry_key_handle *key, const char *subkey);
|
||||
int fetch_reg_keys(struct registry_key_handle *key,
|
||||
struct regsubkey_ctr *subkey_ctr);
|
||||
int fetch_reg_values(struct registry_key_handle *key, struct regval_ctr *val);
|
||||
bool regkey_access_check(struct registry_key_handle *key, uint32 requested,
|
||||
uint32 *granted,
|
||||
const struct nt_user_token *token);
|
||||
WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, struct registry_key_handle *key,
|
||||
struct security_descriptor **psecdesc);
|
||||
WERROR regkey_set_secdesc(REGISTRY_KEY *key,
|
||||
WERROR regkey_set_secdesc(struct registry_key_handle *key,
|
||||
struct security_descriptor *psecdesc);
|
||||
bool reg_subkeys_need_update(REGISTRY_KEY *key, struct regsubkey_ctr *subkeys);
|
||||
bool reg_values_need_update(REGISTRY_KEY *key, struct regval_ctr *values);
|
||||
bool reg_subkeys_need_update(struct registry_key_handle *key,
|
||||
struct regsubkey_ctr *subkeys);
|
||||
bool reg_values_need_update(struct registry_key_handle *key,
|
||||
struct regval_ctr *values);
|
||||
|
||||
/* The following definitions come from registry/reg_eventlog.c */
|
||||
|
||||
@ -4963,7 +4968,8 @@ size_t regval_build_multi_sz( char **values, uint16 **buffer );
|
||||
|
||||
/* The following definitions come from registry/reg_util_legacy.c */
|
||||
|
||||
WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey,
|
||||
WERROR regkey_open_internal(TALLOC_CTX *ctx,
|
||||
struct registry_key_handle **regkey,
|
||||
const char *path,
|
||||
const struct nt_user_token *token,
|
||||
uint32 access_desired );
|
||||
|
@ -153,15 +153,15 @@ typedef struct {
|
||||
|
||||
/* structure to store the registry handles */
|
||||
|
||||
typedef struct _RegistryKey {
|
||||
struct registry_key_handle {
|
||||
uint32 type;
|
||||
char *name; /* full name of registry key */
|
||||
uint32 access_granted;
|
||||
REGISTRY_OPS *ops;
|
||||
} REGISTRY_KEY;
|
||||
};
|
||||
|
||||
struct registry_key {
|
||||
REGISTRY_KEY *key;
|
||||
struct registry_key_handle *key;
|
||||
struct regsubkey_ctr *subkeys;
|
||||
struct regval_ctr *values;
|
||||
struct nt_user_token *token;
|
||||
|
@ -113,7 +113,7 @@ static WERROR fill_subkey_cache(struct registry_key *key)
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
static int regkey_destructor(REGISTRY_KEY *key)
|
||||
static int regkey_destructor(struct registry_key_handle *key)
|
||||
{
|
||||
return regdb_close();
|
||||
}
|
||||
@ -127,7 +127,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
|
||||
{
|
||||
WERROR result = WERR_OK;
|
||||
struct registry_key *regkey;
|
||||
REGISTRY_KEY *key;
|
||||
struct registry_key_handle *key;
|
||||
struct regsubkey_ctr *subkeys = NULL;
|
||||
|
||||
DEBUG(7,("regkey_open_onelevel: name = [%s]\n", name));
|
||||
@ -136,7 +136,8 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
|
||||
|
||||
if (!(regkey = TALLOC_ZERO_P(mem_ctx, struct registry_key)) ||
|
||||
!(regkey->token = dup_nt_token(regkey, token)) ||
|
||||
!(regkey->key = TALLOC_ZERO_P(regkey, REGISTRY_KEY))) {
|
||||
!(regkey->key = TALLOC_ZERO_P(regkey, struct registry_key_handle)))
|
||||
{
|
||||
result = WERR_NOMEM;
|
||||
goto done;
|
||||
}
|
||||
@ -709,14 +710,14 @@ static WERROR reg_load_tree(REGF_FILE *regfile, const char *topkeypath,
|
||||
REGF_NK_REC *key)
|
||||
{
|
||||
REGF_NK_REC *subkey;
|
||||
REGISTRY_KEY registry_key;
|
||||
struct registry_key_handle registry_key;
|
||||
struct regval_ctr *values;
|
||||
struct regsubkey_ctr *subkeys;
|
||||
int i;
|
||||
char *path = NULL;
|
||||
WERROR result = WERR_OK;
|
||||
|
||||
/* initialize the REGISTRY_KEY structure */
|
||||
/* initialize the struct registry_key_handle structure */
|
||||
|
||||
registry_key.ops = reghook_cache_find(topkeypath);
|
||||
if (!registry_key.ops) {
|
||||
@ -799,7 +800,8 @@ static WERROR reg_load_tree(REGF_FILE *regfile, const char *topkeypath,
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static WERROR restore_registry_key(REGISTRY_KEY *krecord, const char *fname)
|
||||
static WERROR restore_registry_key(struct registry_key_handle *krecord,
|
||||
const char *fname)
|
||||
{
|
||||
REGF_FILE *regfile;
|
||||
REGF_NK_REC *rootkey;
|
||||
@ -850,7 +852,7 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath,
|
||||
char *keyname, *parentpath;
|
||||
char *subkeypath = NULL;
|
||||
char *subkeyname;
|
||||
REGISTRY_KEY registry_key;
|
||||
struct registry_key_handle registry_key;
|
||||
WERROR result = WERR_OK;
|
||||
SEC_DESC *sec_desc = NULL;
|
||||
|
||||
@ -876,7 +878,7 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath,
|
||||
keyname = parentpath;
|
||||
}
|
||||
|
||||
/* we need a REGISTRY_KEY object here to enumerate subkeys and values */
|
||||
/* we need a registry_key_handle object here to enumerate subkeys and values */
|
||||
|
||||
ZERO_STRUCT(registry_key);
|
||||
|
||||
@ -942,7 +944,8 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
static WERROR backup_registry_key(REGISTRY_KEY *krecord, const char *fname)
|
||||
static WERROR backup_registry_key(struct registry_key_handle *krecord,
|
||||
const char *fname)
|
||||
{
|
||||
REGF_FILE *regfile;
|
||||
WERROR result;
|
||||
|
@ -80,7 +80,8 @@ static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd)
|
||||
High level wrapper function for storing registry subkeys
|
||||
***********************************************************************/
|
||||
|
||||
bool store_reg_keys( REGISTRY_KEY *key, struct regsubkey_ctr *subkeys )
|
||||
bool store_reg_keys(struct registry_key_handle *key,
|
||||
struct regsubkey_ctr *subkeys)
|
||||
{
|
||||
if (key->ops && key->ops->store_subkeys)
|
||||
return key->ops->store_subkeys(key->name, subkeys);
|
||||
@ -92,7 +93,7 @@ bool store_reg_keys( REGISTRY_KEY *key, struct regsubkey_ctr *subkeys )
|
||||
High level wrapper function for storing registry values
|
||||
***********************************************************************/
|
||||
|
||||
bool store_reg_values(REGISTRY_KEY *key, struct regval_ctr *val)
|
||||
bool store_reg_values(struct registry_key_handle *key, struct regval_ctr *val)
|
||||
{
|
||||
if (key->ops && key->ops->store_values)
|
||||
return key->ops->store_values(key->name, val);
|
||||
@ -100,7 +101,7 @@ bool store_reg_values(REGISTRY_KEY *key, struct regval_ctr *val)
|
||||
return false;
|
||||
}
|
||||
|
||||
WERROR create_reg_subkey(REGISTRY_KEY *key, const char *subkey)
|
||||
WERROR create_reg_subkey(struct registry_key_handle *key, const char *subkey)
|
||||
{
|
||||
if (key->ops && key->ops->create_subkey) {
|
||||
return key->ops->create_subkey(key->name, subkey);
|
||||
@ -109,7 +110,7 @@ WERROR create_reg_subkey(REGISTRY_KEY *key, const char *subkey)
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
WERROR delete_reg_subkey(REGISTRY_KEY *key, const char *subkey)
|
||||
WERROR delete_reg_subkey(struct registry_key_handle *key, const char *subkey)
|
||||
{
|
||||
if (key->ops && key->ops->delete_subkey) {
|
||||
return key->ops->delete_subkey(key->name, subkey);
|
||||
@ -123,7 +124,8 @@ WERROR delete_reg_subkey(REGISTRY_KEY *key, const char *subkey)
|
||||
Initialize the TALLOC_CTX if necessary
|
||||
***********************************************************************/
|
||||
|
||||
int fetch_reg_keys( REGISTRY_KEY *key, struct regsubkey_ctr *subkey_ctr )
|
||||
int fetch_reg_keys(struct registry_key_handle *key,
|
||||
struct regsubkey_ctr *subkey_ctr)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
@ -137,7 +139,7 @@ int fetch_reg_keys( REGISTRY_KEY *key, struct regsubkey_ctr *subkey_ctr )
|
||||
High level wrapper function for enumerating registry values
|
||||
***********************************************************************/
|
||||
|
||||
int fetch_reg_values(REGISTRY_KEY *key, struct regval_ctr *val)
|
||||
int fetch_reg_values(struct registry_key_handle *key, struct regval_ctr *val)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
@ -155,7 +157,8 @@ int fetch_reg_values(REGISTRY_KEY *key, struct regval_ctr *val)
|
||||
underlying registry backend
|
||||
***********************************************************************/
|
||||
|
||||
bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted,
|
||||
bool regkey_access_check(struct registry_key_handle *key, uint32 requested,
|
||||
uint32 *granted,
|
||||
const struct nt_user_token *token )
|
||||
{
|
||||
SEC_DESC *sec_desc;
|
||||
@ -187,7 +190,7 @@ bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted,
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
|
||||
WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
|
||||
WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, struct registry_key_handle *key,
|
||||
struct security_descriptor **psecdesc)
|
||||
{
|
||||
struct security_descriptor *secdesc;
|
||||
@ -209,7 +212,7 @@ WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
WERROR regkey_set_secdesc(REGISTRY_KEY *key,
|
||||
WERROR regkey_set_secdesc(struct registry_key_handle *key,
|
||||
struct security_descriptor *psecdesc)
|
||||
{
|
||||
if (key->ops && key->ops->set_secdesc) {
|
||||
@ -223,7 +226,8 @@ WERROR regkey_set_secdesc(REGISTRY_KEY *key,
|
||||
* Check whether the in-memory version of the subkyes of a
|
||||
* registry key needs update from disk.
|
||||
*/
|
||||
bool reg_subkeys_need_update(REGISTRY_KEY *key, struct regsubkey_ctr *subkeys)
|
||||
bool reg_subkeys_need_update(struct registry_key_handle *key,
|
||||
struct regsubkey_ctr *subkeys)
|
||||
{
|
||||
if (key->ops && key->ops->subkeys_need_update)
|
||||
{
|
||||
@ -237,7 +241,8 @@ bool reg_subkeys_need_update(REGISTRY_KEY *key, struct regsubkey_ctr *subkeys)
|
||||
* Check whether the in-memory version of the values of a
|
||||
* registry key needs update from disk.
|
||||
*/
|
||||
bool reg_values_need_update(REGISTRY_KEY *key, struct regval_ctr *values)
|
||||
bool reg_values_need_update(struct registry_key_handle *key,
|
||||
struct regval_ctr *values)
|
||||
{
|
||||
if (key->ops && key->ops->values_need_update)
|
||||
{
|
||||
|
@ -28,7 +28,8 @@
|
||||
* legacy open key function that should be replaced by uses of
|
||||
* reg_open_path
|
||||
*/
|
||||
WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey,
|
||||
WERROR regkey_open_internal(TALLOC_CTX *ctx,
|
||||
struct registry_key_handle **regkey,
|
||||
const char *path,
|
||||
const struct nt_user_token *token,
|
||||
uint32 access_desired )
|
||||
|
@ -332,10 +332,11 @@ static void fill_service_values(const char *name, struct regval_ctr *values)
|
||||
/********************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static void add_new_svc_name( REGISTRY_KEY *key_parent, struct regsubkey_ctr *subkeys,
|
||||
static void add_new_svc_name(struct registry_key_handle *key_parent,
|
||||
struct regsubkey_ctr *subkeys,
|
||||
const char *name )
|
||||
{
|
||||
REGISTRY_KEY *key_service = NULL, *key_secdesc = NULL;
|
||||
struct registry_key_handle *key_service = NULL, *key_secdesc = NULL;
|
||||
WERROR wresult;
|
||||
char *path = NULL;
|
||||
struct regval_ctr *values = NULL;
|
||||
@ -446,7 +447,7 @@ void svcctl_init_keys( void )
|
||||
const char **service_list = lp_svcctl_list();
|
||||
int i;
|
||||
struct regsubkey_ctr *subkeys = NULL;
|
||||
REGISTRY_KEY *key = NULL;
|
||||
struct registry_key_handle *key = NULL;
|
||||
WERROR wresult;
|
||||
|
||||
/* bad mojo here if the lookup failed. Should not happen */
|
||||
@ -504,7 +505,7 @@ void svcctl_init_keys( void )
|
||||
|
||||
SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
|
||||
{
|
||||
REGISTRY_KEY *key = NULL;
|
||||
struct registry_key_handle *key = NULL;
|
||||
struct regval_ctr *values = NULL;
|
||||
struct regval_blob *val = NULL;
|
||||
SEC_DESC *ret_sd = NULL;
|
||||
@ -565,7 +566,7 @@ done:
|
||||
|
||||
bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc, NT_USER_TOKEN *token )
|
||||
{
|
||||
REGISTRY_KEY *key = NULL;
|
||||
struct registry_key_handle *key = NULL;
|
||||
WERROR wresult;
|
||||
char *path = NULL;
|
||||
struct regval_ctr *values = NULL;
|
||||
@ -619,7 +620,7 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
|
||||
const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
|
||||
{
|
||||
char *display_name = NULL;
|
||||
REGISTRY_KEY *key = NULL;
|
||||
struct registry_key_handle *key = NULL;
|
||||
struct regval_ctr *values = NULL;
|
||||
struct regval_blob *val = NULL;
|
||||
char *path = NULL;
|
||||
@ -669,7 +670,7 @@ fail:
|
||||
const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
|
||||
{
|
||||
char *description = NULL;
|
||||
REGISTRY_KEY *key = NULL;
|
||||
struct registry_key_handle *key = NULL;
|
||||
struct regval_ctr *values = NULL;
|
||||
struct regval_blob *val = NULL;
|
||||
char *path = NULL;
|
||||
@ -714,7 +715,7 @@ const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER
|
||||
|
||||
struct regval_ctr *svcctl_fetch_regvalues(const char *name, NT_USER_TOKEN *token)
|
||||
{
|
||||
REGISTRY_KEY *key = NULL;
|
||||
struct registry_key_handle *key = NULL;
|
||||
struct regval_ctr *values = NULL;
|
||||
char *path = NULL;
|
||||
WERROR wresult;
|
||||
|
Loading…
Reference in New Issue
Block a user