summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/reg_objects.h2
-rw-r--r--source3/registry/reg_api.c16
-rw-r--r--source3/registry/reg_cachehook.c25
-rw-r--r--source3/registry/reg_dispatcher.c41
-rw-r--r--source3/registry/reg_init_full.c2
-rw-r--r--source3/registry/reg_init_smbconf.c3
-rw-r--r--source3/script/mkproto.awk2
7 files changed, 44 insertions, 47 deletions
diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h
index 1d0d0d4996..d9159dd464 100644
--- a/source3/include/reg_objects.h
+++ b/source3/include/reg_objects.h
@@ -159,7 +159,7 @@ typedef struct _RegistryKey {
uint32 type;
char *name; /* full name of registry key */
uint32 access_granted;
- REGISTRY_HOOK *hook;
+ REGISTRY_OPS *ops;
} REGISTRY_KEY;
struct registry_key {
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index 1a0bf2b16a..cbbc7dd0ef 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -183,9 +183,9 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
/* Look up the table of registry I/O operations */
- if ( !(key->hook = reghook_cache_find( key->name )) ) {
- DEBUG(0,("reg_open_onelevel: Failed to assign a "
- "REGISTRY_HOOK to [%s]\n", key->name ));
+ if ( !(key->ops = reghook_cache_find( key->name )) ) {
+ DEBUG(0,("reg_open_onelevel: Failed to assign "
+ "REGISTRY_OPS to [%s]\n", key->name ));
result = WERR_BADFILE;
goto done;
}
@@ -733,9 +733,9 @@ static WERROR reg_load_tree(REGF_FILE *regfile, const char *topkeypath,
/* initialize the REGISTRY_KEY structure */
- registry_key.hook = reghook_cache_find(topkeypath);
- if (!registry_key.hook) {
- DEBUG(0, ("reg_load_tree: Failed to assigned a REGISTRY_HOOK "
+ registry_key.ops = reghook_cache_find(topkeypath);
+ if (!registry_key.ops) {
+ DEBUG(0, ("reg_load_tree: Failed to assign REGISTRY_OPS "
"to [%s]\n", topkeypath));
return WERR_BADFILE;
}
@@ -898,8 +898,8 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath,
return WERR_NOMEM;
}
- registry_key.hook = reghook_cache_find(registry_key.name);
- if (registry_key.hook == NULL) {
+ registry_key.ops = reghook_cache_find(registry_key.name);
+ if (registry_key.ops == NULL) {
return WERR_BADFILE;
}
diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c
index f9851c7810..7ce39aff25 100644
--- a/source3/registry/reg_cachehook.c
+++ b/source3/registry/reg_cachehook.c
@@ -27,7 +27,6 @@
static SORTED_TREE *cache_tree = NULL;
extern REGISTRY_OPS regdb_ops; /* these are the default */
-static REGISTRY_HOOK default_hook = { KEY_TREE_ROOT, &regdb_ops };
/**********************************************************************
Initialize the cache tree if it has not been initialized yet.
@@ -36,7 +35,7 @@ static REGISTRY_HOOK default_hook = { KEY_TREE_ROOT, &regdb_ops };
bool reghook_cache_init( void )
{
if (cache_tree == NULL) {
- cache_tree = pathtree_init(&default_hook, NULL);
+ cache_tree = pathtree_init(&regdb_ops, NULL);
if (cache_tree !=0) {
DEBUG(10, ("reghook_cache_init: new tree with default "
"ops %p for key [%s]\n", (void *)&regdb_ops,
@@ -48,20 +47,20 @@ bool reghook_cache_init( void )
}
/**********************************************************************
- Add a new REGISTRY_HOOK to the cache. Note that the keyname
+ Add a new registry hook to the cache. Note that the keyname
is not in the exact format that a SORTED_TREE expects.
*********************************************************************/
-bool reghook_cache_add( REGISTRY_HOOK *hook )
+bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
{
TALLOC_CTX *ctx = talloc_tos();
char *key = NULL;
- if (!hook) {
+ if ((keyname == NULL) || (ops == NULL)) {
return false;
}
- key = talloc_asprintf(ctx, "\\%s", hook->keyname);
+ key = talloc_asprintf(ctx, "\\%s", keyname);
if (!key) {
return false;
}
@@ -71,20 +70,20 @@ bool reghook_cache_add( REGISTRY_HOOK *hook )
}
DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n",
- (void *)hook->ops, key));
+ (void *)ops, key));
- return pathtree_add( cache_tree, key, hook );
+ return pathtree_add(cache_tree, key, ops);
}
/**********************************************************************
Initialize the cache tree
*********************************************************************/
-REGISTRY_HOOK* reghook_cache_find( const char *keyname )
+REGISTRY_OPS *reghook_cache_find(const char *keyname)
{
char *key;
int len;
- REGISTRY_HOOK *hook;
+ REGISTRY_OPS *ops;
if ( !keyname )
return NULL;
@@ -107,14 +106,14 @@ REGISTRY_HOOK* reghook_cache_find( const char *keyname )
DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key));
- hook = (REGISTRY_HOOK *)pathtree_find( cache_tree, key ) ;
+ ops = (REGISTRY_OPS *)pathtree_find(cache_tree, key);
DEBUG(10, ("reghook_cache_find: found ops %p for key [%s]\n",
- hook ? (void *)hook->ops : 0, key));
+ ops ? (void *)ops : 0, key));
SAFE_FREE( key );
- return hook;
+ return ops;
}
/**********************************************************************
diff --git a/source3/registry/reg_dispatcher.c b/source3/registry/reg_dispatcher.c
index cdcd045904..c68ecdedeb 100644
--- a/source3/registry/reg_dispatcher.c
+++ b/source3/registry/reg_dispatcher.c
@@ -86,8 +86,8 @@ static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd)
bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys )
{
- if ( key->hook && key->hook->ops && key->hook->ops->store_subkeys )
- return key->hook->ops->store_subkeys( key->name, subkeys );
+ if (key->ops && key->ops->store_subkeys)
+ return key->ops->store_subkeys(key->name, subkeys);
return false;
}
@@ -98,8 +98,8 @@ bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys )
bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
{
- if ( key->hook && key->hook->ops && key->hook->ops->store_values )
- return key->hook->ops->store_values( key->name, val );
+ if (key->ops && key->ops->store_values)
+ return key->ops->store_values(key->name, val);
return false;
}
@@ -113,8 +113,8 @@ int fetch_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkey_ctr )
{
int result = -1;
- if ( key->hook && key->hook->ops && key->hook->ops->fetch_subkeys )
- result = key->hook->ops->fetch_subkeys( key->name, subkey_ctr );
+ if (key->ops && key->ops->fetch_subkeys)
+ result = key->ops->fetch_subkeys(key->name, subkey_ctr);
return result;
}
@@ -128,10 +128,10 @@ int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
int result = -1;
DEBUG(10, ("fetch_reg_values called for key '%s' (ops %p)\n", key->name,
- (key->hook && key->hook->ops) ? (void *)key->hook->ops : NULL));
+ (key->ops) ? (void *)key->ops : NULL));
- if ( key->hook && key->hook->ops && key->hook->ops->fetch_values )
- result = key->hook->ops->fetch_values( key->name, val );
+ if (key->ops && key->ops->fetch_values)
+ result = key->ops->fetch_values(key->name, val);
return result;
}
@@ -152,9 +152,9 @@ bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted,
/* use the default security check if the backend has not defined its
* own */
- if (key->hook && key->hook->ops && key->hook->ops->reg_access_check) {
- return key->hook->ops->reg_access_check( key->name, requested,
- granted, token );
+ if (key->ops && key->ops->reg_access_check) {
+ return key->ops->reg_access_check(key->name, requested,
+ granted, token);
}
/*
@@ -189,9 +189,8 @@ WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
struct security_descriptor *secdesc;
WERROR werr;
- if (key->hook && key->hook->ops && key->hook->ops->get_secdesc) {
- werr = key->hook->ops->get_secdesc(mem_ctx, key->name,
- psecdesc);
+ if (key->ops && key->ops->get_secdesc) {
+ werr = key->ops->get_secdesc(mem_ctx, key->name, psecdesc);
if (W_ERROR_IS_OK(werr)) {
return WERR_OK;
}
@@ -209,8 +208,8 @@ WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
WERROR regkey_set_secdesc(REGISTRY_KEY *key,
struct security_descriptor *psecdesc)
{
- if (key->hook && key->hook->ops && key->hook->ops->set_secdesc) {
- return key->hook->ops->set_secdesc(key->name, psecdesc);
+ if (key->ops && key->ops->set_secdesc) {
+ return key->ops->set_secdesc(key->name, psecdesc);
}
return WERR_ACCESS_DENIED;
@@ -222,9 +221,9 @@ WERROR regkey_set_secdesc(REGISTRY_KEY *key,
*/
bool reg_subkeys_need_update(REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys)
{
- if (key->hook && key->hook->ops && key->hook->ops->subkeys_need_update)
+ if (key->ops && key->ops->subkeys_need_update)
{
- return key->hook->ops->subkeys_need_update(subkeys);
+ return key->ops->subkeys_need_update(subkeys);
}
return false;
@@ -236,9 +235,9 @@ bool reg_subkeys_need_update(REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys)
*/
bool reg_values_need_update(REGISTRY_KEY *key, REGVAL_CTR *values)
{
- if (key->hook && key->hook->ops && key->hook->ops->values_need_update)
+ if (key->ops && key->ops->values_need_update)
{
- return key->hook->ops->values_need_update(values);
+ return key->ops->values_need_update(values);
}
return false;
diff --git a/source3/registry/reg_init_full.c b/source3/registry/reg_init_full.c
index ad245cb52e..f171949e38 100644
--- a/source3/registry/reg_init_full.c
+++ b/source3/registry/reg_init_full.c
@@ -86,7 +86,7 @@ bool init_registry( void )
reghook_cache_init();
for ( i=0; reg_hooks[i].keyname; i++ ) {
- if ( !reghook_cache_add(&reg_hooks[i]) )
+ if (!reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops))
goto fail;
}
diff --git a/source3/registry/reg_init_smbconf.c b/source3/registry/reg_init_smbconf.c
index f76cc2f051..d1acd213c1 100644
--- a/source3/registry/reg_init_smbconf.c
+++ b/source3/registry/reg_init_smbconf.c
@@ -71,7 +71,6 @@ bool registry_init_smbconf(void)
{
bool ret = false;
int saved_errno = 0;
- static REGISTRY_HOOK smbconf_reg_hook = {KEY_SMBCONF, &smbconf_reg_ops};
DEBUG(10, ("registry_init_smbconf called\n"));
@@ -90,7 +89,7 @@ bool registry_init_smbconf(void)
goto done;
}
reghook_cache_init();
- if (!reghook_cache_add(&smbconf_reg_hook)) {
+ if (!reghook_cache_add(KEY_SMBCONF, &smbconf_reg_ops)) {
DEBUG(1, ("Error adding smbconf reghooks to reghook cache.\n"));
goto done;
}
diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk
index e9839fe498..0fcfbb1e19 100644
--- a/source3/script/mkproto.awk
+++ b/source3/script/mkproto.awk
@@ -143,7 +143,7 @@ END {
gotstart = 1;
}
- if( $0 ~ /^SAM_ACCT_INFO_NODE|^SMB_ACL_T|^ADS_MODLIST|^PyObject|^SORTED_TREE|^REGISTRY_HOOK|^REGISTRY_VALUE|^REGVAL_CTR|^DEVICEMODE|^PAC_DATA|^NET_USER_INFO_3|^smb_event_id_t/ ) {
+ if( $0 ~ /^SAM_ACCT_INFO_NODE|^SMB_ACL_T|^ADS_MODLIST|^PyObject|^SORTED_TREE|^REGISTRY_HOOK|^REGISTRY_OPS|^REGISTRY_VALUE|^REGVAL_CTR|^DEVICEMODE|^PAC_DATA|^NET_USER_INFO_3|^smb_event_id_t/ ) {
gotstart = 1;
}