summaryrefslogtreecommitdiff
path: root/source3/lib/netapi/joindomain.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-19 10:55:52 +0100
committerGünther Deschner <gd@samba.org>2007-12-21 15:29:11 +0100
commit8f7723fc28cf9e71b0d5ef2890dbe95ae3fc5e07 (patch)
tree947e61c1c2159a3efb09742b5fd215d992d7a5ec /source3/lib/netapi/joindomain.c
parent14652eab180fa9555607a413e5d1b429d1e1673c (diff)
downloadsamba-8f7723fc28cf9e71b0d5ef2890dbe95ae3fc5e07.tar.gz
samba-8f7723fc28cf9e71b0d5ef2890dbe95ae3fc5e07.tar.bz2
samba-8f7723fc28cf9e71b0d5ef2890dbe95ae3fc5e07.zip
Remove unrequired TALLOC_CTX from libnetapi_NetJoinDomain & friends.
Guenther (This used to be commit 96ebdca45b998da7e6137973dea717bf3ac76328)
Diffstat (limited to 'source3/lib/netapi/joindomain.c')
-rw-r--r--source3/lib/netapi/joindomain.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c
index 180210f707..08a39549f9 100644
--- a/source3/lib/netapi/joindomain.c
+++ b/source3/lib/netapi/joindomain.c
@@ -154,44 +154,28 @@ static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx,
const char *password,
uint32_t join_flags)
{
- TALLOC_CTX *mem_ctx = NULL;
- WERROR werr;
-
- mem_ctx = talloc_init("NetJoinDomain");
- if (!mem_ctx) {
- werr = WERR_NOMEM;
- goto done;
- }
-
if (!domain_name) {
- werr = WERR_INVALID_PARAM;
- goto done;
+ return WERR_INVALID_PARAM;
}
if (!server_name || is_myname_or_ipaddr(server_name)) {
- werr = NetJoinDomainLocal(ctx,
+ return NetJoinDomainLocal(ctx,
server_name,
domain_name,
account_ou,
Account,
password,
join_flags);
-
- goto done;
}
- werr = NetJoinDomainRemote(ctx,
+ return NetJoinDomainRemote(ctx,
server_name,
domain_name,
account_ou,
Account,
password,
join_flags);
-done:
- TALLOC_FREE(mem_ctx);
-
- return werr;
}
NET_API_STATUS NetJoinDomain(const char *server_name,
@@ -230,7 +214,6 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx,
const char *password,
uint32_t unjoin_flags)
{
- TALLOC_CTX *mem_ctx = NULL;
struct cli_state *cli = NULL;
struct rpc_pipe_client *pipe_cli = NULL;
struct wkssvc_PasswordBuffer encrypted_password;
@@ -240,17 +223,6 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx,
ZERO_STRUCT(encrypted_password);
- mem_ctx = talloc_init("NetUnjoinDomain");
- if (!mem_ctx) {
- werr = WERR_NOMEM;
- goto done;
- }
-
- if (!server_name || is_myname_or_ipaddr(server_name)) {
- werr = WERR_NOT_SUPPORTED;
- goto done;
- }
-
status = cli_full_connection(&cli, NULL, server_name,
NULL, 0,
"IPC$", "IPC",
@@ -274,7 +246,7 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx,
};
if (password) {
- encode_wkssvc_join_password_buffer(mem_ctx,
+ encode_wkssvc_join_password_buffer(ctx,
password,
&cli->user_session_key,
&encrypted_password);
@@ -282,7 +254,7 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx,
old_timeout = cli_set_timeout(cli, 60000);
- status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, mem_ctx,
+ status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, ctx,
server_name,
account,
&encrypted_password,
@@ -298,7 +270,6 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx,
cli_set_timeout(cli, old_timeout);
cli_shutdown(cli);
}
- TALLOC_FREE(mem_ctx);
return werr;
}