diff options
author | Michael Adam <obnox@samba.org> | 2007-12-25 03:05:06 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2007-12-25 03:05:06 +0100 |
commit | e5a87c2543dea12488250eb8e15dcfe02b34dfe1 (patch) | |
tree | 8cab86c51d42f608318bd8dc28fbdee8829e2432 | |
parent | 2764f5a0a6404b1ade9b996783e0a131b7b2d231 (diff) | |
download | samba-e5a87c2543dea12488250eb8e15dcfe02b34dfe1.tar.gz samba-e5a87c2543dea12488250eb8e15dcfe02b34dfe1.tar.bz2 samba-e5a87c2543dea12488250eb8e15dcfe02b34dfe1.zip |
Remove talloc context parameter from libnet_smbconf_drop().
Make use of talloc_stackframe.
Michael
(This used to be commit aaceab1153f6c2a2adde83681913c771a16ca81f)
-rw-r--r-- | source3/libnet/libnet_conf.c | 22 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 2 |
2 files changed, 9 insertions, 15 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index bc8dc9e4d0..c85579b8e0 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,29 +243,23 @@ done: * **********************************************************************/ -WERROR libnet_smbconf_drop(TALLOC_CTX *ctx) +WERROR libnet_smbconf_drop(void) { char *path, *p; WERROR werr = WERR_OK; NT_USER_TOKEN *token; struct registry_key *parent_key = NULL; struct registry_key *new_key = NULL; - TALLOC_CTX* tmp_ctx = NULL; + TALLOC_CTX* mem_ctx = talloc_stackframe(); enum winreg_CreateAction action; - tmp_ctx = talloc_new(ctx); - if (tmp_ctx == NULL) { - werr = WERR_NOMEM; - goto done; - } - - if (!(token = registry_create_admin_token(tmp_ctx))) { + if (!(token = registry_create_admin_token(mem_ctx))) { /* what is the appropriate error code here? */ werr = WERR_CAN_NOT_COMPLETE; goto done; } - path = talloc_strdup(tmp_ctx, KEY_SMBCONF); + path = talloc_strdup(mem_ctx, KEY_SMBCONF); if (path == NULL) { d_fprintf(stderr, "ERROR: out of memory!\n"); werr = WERR_NOMEM; @@ -273,23 +267,23 @@ WERROR libnet_smbconf_drop(TALLOC_CTX *ctx) } p = strrchr(path, '\\'); *p = '\0'; - werr = reg_open_path(tmp_ctx, path, REG_KEY_WRITE, token, &parent_key); + werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token, &parent_key); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_deletekey_recursive(tmp_ctx, parent_key, p+1); + werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_createkey(tmp_ctx, parent_key, p+1, REG_KEY_WRITE, + werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE, &new_key, &action); done: - TALLOC_FREE(tmp_ctx); + TALLOC_FREE(mem_ctx); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 6d59643bee..9a6f5400e1 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -538,7 +538,7 @@ int net_conf_drop(int argc, const char **argv) goto done; } - werr = libnet_smbconf_drop(NULL); + werr = libnet_smbconf_drop(); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting configuration: %s\n", dos_errstr(werr)); |