diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 5 | ||||
-rw-r--r-- | source3/libgpo/gpext/scripts.c | 2 | ||||
-rw-r--r-- | source3/libgpo/gpo_reg.c | 4 | ||||
-rw-r--r-- | source3/registry/reg_api.c | 30 | ||||
-rw-r--r-- | source3/registry/reg_api.h | 6 | ||||
-rw-r--r-- | source3/utils/net_registry.c | 2 |
6 files changed, 17 insertions, 32 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 11affd9479..980c5b7e03 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -721,7 +721,7 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx) goto done; } - werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1); + werr = reg_deletekey_recursive(parent_key, p+1); if (!W_ERROR_IS_OK(werr)) { goto done; @@ -913,8 +913,7 @@ static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx, TALLOC_CTX *mem_ctx = talloc_stackframe(); if (servicename != NULL) { - werr = reg_deletekey_recursive(mem_ctx, rpd(ctx)->base_key, - servicename); + werr = reg_deletekey_recursive(rpd(ctx)->base_key, servicename); } else { werr = smbconf_reg_delete_values(rpd(ctx)->base_key); } diff --git a/source3/libgpo/gpext/scripts.c b/source3/libgpo/gpext/scripts.c index 693924dbee..09dc3de492 100644 --- a/source3/libgpo/gpext/scripts.c +++ b/source3/libgpo/gpext/scripts.c @@ -301,7 +301,7 @@ static WERROR scripts_apply(TALLOC_CTX *mem_ctx, section, count++); W_ERROR_HAVE_NO_MEMORY(keystr); - reg_deletekey_recursive(mem_ctx, root_key, keystr); + reg_deletekey_recursive(root_key, keystr); werr = gp_store_reg_subkey(mem_ctx, keystr, root_key, &root_key); diff --git a/source3/libgpo/gpo_reg.c b/source3/libgpo/gpo_reg.c index 83f7e8de78..375a2d31ff 100644 --- a/source3/libgpo/gpo_reg.c +++ b/source3/libgpo/gpo_reg.c @@ -326,7 +326,7 @@ static WERROR gp_reg_del_groupmembership(TALLOC_CTX *mem_ctx, flags); W_ERROR_HAVE_NO_MEMORY(path); - return reg_deletekey_recursive(mem_ctx, key, path); + return reg_deletekey_recursive(key, path); } @@ -447,7 +447,7 @@ static WERROR gp_del_reg_state(TALLOC_CTX *mem_ctx, struct registry_key *key, const char *path) { - return reg_deletesubkeys_recursive(mem_ctx, key, path); + return reg_deletesubkeys_recursive(key, path); } /**************************************************************** diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 31950f75cb..a98eaf8271 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -784,22 +784,15 @@ WERROR reg_deleteallvalues(struct registry_key *key) * Note that reg_deletekey returns ACCESS_DENIED when called on a * key that has subkeys. */ -static WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, - struct registry_key *parent, +static WERROR reg_deletekey_recursive_internal(struct registry_key *parent, const char *path, bool del_key) { - TALLOC_CTX *mem_ctx = NULL; WERROR werr = WERR_OK; struct registry_key *key; char *subkey_name = NULL; uint32 i; - - mem_ctx = talloc_new(ctx); - if (mem_ctx == NULL) { - werr = WERR_NOMEM; - goto done; - } + TALLOC_CTX *mem_ctx = talloc_stackframe(); /* recurse through subkeys first */ werr = reg_openkey(mem_ctx, parent, path, REG_KEY_ALL, &key); @@ -816,9 +809,7 @@ static WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, */ for (i = regsubkey_ctr_numkeys(key->subkeys) ; i > 0; i--) { subkey_name = regsubkey_ctr_specific_key(key->subkeys, i-1); - werr = reg_deletekey_recursive_internal(mem_ctx, key, - subkey_name, - true); + werr = reg_deletekey_recursive_internal(key, subkey_name, true); W_ERROR_NOT_OK_GOTO_DONE(werr); } @@ -832,8 +823,7 @@ done: return werr; } -static WERROR reg_deletekey_recursive_trans(TALLOC_CTX *ctx, - struct registry_key *parent, +static WERROR reg_deletekey_recursive_trans(struct registry_key *parent, const char *path, bool del_key) { @@ -847,7 +837,7 @@ static WERROR reg_deletekey_recursive_trans(TALLOC_CTX *ctx, return werr; } - werr = reg_deletekey_recursive_internal(ctx, parent, path, del_key); + werr = reg_deletekey_recursive_internal(parent, path, del_key); if (!W_ERROR_IS_OK(werr)) { DEBUG(1, (__location__ " failed to delete key '%s' from key " @@ -871,17 +861,15 @@ static WERROR reg_deletekey_recursive_trans(TALLOC_CTX *ctx, return werr; } -WERROR reg_deletekey_recursive(TALLOC_CTX *ctx, - struct registry_key *parent, +WERROR reg_deletekey_recursive(struct registry_key *parent, const char *path) { - return reg_deletekey_recursive_trans(ctx, parent, path, true); + return reg_deletekey_recursive_trans(parent, path, true); } -WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, - struct registry_key *parent, +WERROR reg_deletesubkeys_recursive(struct registry_key *parent, const char *path) { - return reg_deletekey_recursive_trans(ctx, parent, path, false); + return reg_deletekey_recursive_trans(parent, path, false); } diff --git a/source3/registry/reg_api.h b/source3/registry/reg_api.h index 2a4f6dbbf6..41c4792e59 100644 --- a/source3/registry/reg_api.h +++ b/source3/registry/reg_api.h @@ -61,11 +61,9 @@ WERROR reg_setkeysecurity(struct registry_key *key, struct security_descriptor *psecdesc); WERROR reg_getversion(uint32_t *version); WERROR reg_deleteallvalues(struct registry_key *key); -WERROR reg_deletekey_recursive(TALLOC_CTX *ctx, - struct registry_key *parent, +WERROR reg_deletekey_recursive(struct registry_key *parent, const char *path); -WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, - struct registry_key *parent, +WERROR reg_deletesubkeys_recursive(struct registry_key *parent, const char *path); diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 1139e45bef..6021fa08e1 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -835,7 +835,7 @@ static WERROR import_delete_key(struct import_ctx* ctx, name = subkeyname; } - werr = reg_deletekey_recursive(mem_ctx, parent, name); + werr = reg_deletekey_recursive(parent, name); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "reg_deletekey_recursive %s: %s\n", _("failed"), win_errstr(werr)); |