From e73e8297f5484b6c7f525917679414c09a145cf0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Apr 2008 13:51:46 +0200 Subject: Replace cli_rpc_pipe_close by a talloc destructor on rpc_pipe_struct (This used to be commit 99fc3283c4ecc791f5a242bd1983b4352ce3e6cf) --- source3/utils/net_rpc.c | 18 +++++++++--------- source3/utils/net_rpc_join.c | 8 ++++---- source3/utils/net_rpc_shell.c | 2 +- source3/utils/net_util.c | 2 +- source3/utils/smbcacls.c | 8 ++------ source3/utils/smbtree.c | 4 ++-- 6 files changed, 19 insertions(+), 23 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 330317b0fd..f6f0c4054c 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -88,7 +88,7 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx, *domain_sid = info->account_domain.sid; rpccli_lsa_Close(lsa_pipe, mem_ctx, &pol); - cli_rpc_pipe_close(lsa_pipe); + TALLOC_FREE(lsa_pipe); return NT_STATUS_OK; } @@ -185,7 +185,7 @@ int run_rpc_command(struct cli_state *cli_arg, if (!(conn_flags & NET_FLAGS_NO_PIPE)) { if (pipe_hnd) { - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); } } @@ -1973,7 +1973,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli, done: if (pipe_hnd) { - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); } if (!NT_STATUS_IS_OK(result) && (StrnCaseCmp(name, "S-", 2) == 0)) { @@ -2748,14 +2748,14 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd, if (!NT_STATUS_IS_OK(result)) { d_fprintf(stderr, "Couldn't open LSA policy handle\n"); - cli_rpc_pipe_close(lsa_pipe); + TALLOC_FREE(lsa_pipe); return result; } alias_sids = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members); if (!alias_sids) { d_fprintf(stderr, "Out of memory\n"); - cli_rpc_pipe_close(lsa_pipe); + TALLOC_FREE(lsa_pipe); return NT_STATUS_NO_MEMORY; } @@ -2770,7 +2770,7 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd, if (!NT_STATUS_IS_OK(result) && !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED)) { d_fprintf(stderr, "Couldn't lookup SIDs\n"); - cli_rpc_pipe_close(lsa_pipe); + TALLOC_FREE(lsa_pipe); return result; } @@ -2790,7 +2790,7 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd, } } - cli_rpc_pipe_close(lsa_pipe); + TALLOC_FREE(lsa_pipe); return NT_STATUS_OK; } @@ -5652,7 +5652,7 @@ static NTSTATUS rpc_trustdom_get_pdc(struct cli_state *cli, domain_name, &buffer, NULL); - cli_rpc_pipe_close(netr); + TALLOC_FREE(netr); if (NT_STATUS_IS_OK(status)) { return status; @@ -6248,7 +6248,7 @@ static int rpc_trustdom_list(int argc, const char **argv) return -1; }; - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); /* * Listing trusting domains (stored in passdb backend, if local) diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index b868ea824f..c94e9d1a40 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -221,7 +221,7 @@ int net_rpc_join_newstyle(int argc, const char **argv) domain_sid = info->account_domain.sid; rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol); - cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */ + TALLOC_FREE(pipe_hnd); /* Done with this pipe */ /* Bail out if domain didn't get set. */ if (!domain) { @@ -368,7 +368,7 @@ int net_rpc_join_newstyle(int argc, const char **argv) &set_info); rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); - cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */ + TALLOC_FREE(pipe_hnd); /* Done with this pipe */ /* Now check the whole process from top-to-bottom */ @@ -429,10 +429,10 @@ int net_rpc_join_newstyle(int argc, const char **argv) goto done; } - cli_rpc_pipe_close(netlogon_schannel_pipe); + TALLOC_FREE(netlogon_schannel_pipe); } - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); /* Now store the secret in the secrets database */ diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c index e6302b652e..7bd726e614 100644 --- a/source3/utils/net_rpc_shell.c +++ b/source3/utils/net_rpc_shell.c @@ -85,7 +85,7 @@ static NTSTATUS net_sh_run(struct rpc_sh_ctx *ctx, struct rpc_sh_cmd *cmd, status = cmd->fn(mem_ctx, ctx, pipe_hnd, argc, argv); - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); talloc_destroy(mem_ctx); diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c index f844992d56..576c2191b3 100644 --- a/source3/utils/net_util.c +++ b/source3/utils/net_util.c @@ -75,7 +75,7 @@ NTSTATUS net_rpc_lookup_name(TALLOC_CTX *mem_ctx, struct cli_state *cli, if (is_valid_policy_hnd(&pol)) { rpccli_lsa_Close(lsa_pipe, mem_ctx, &pol); } - cli_rpc_pipe_close(lsa_pipe); + TALLOC_FREE(lsa_pipe); return result; } diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 134f561760..af14c622dc 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -103,9 +103,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, status = NT_STATUS_OK; fail: - if (p != NULL) { - cli_rpc_pipe_close(p); - } + TALLOC_FREE(p); cli_tdis(cli); cli->cnum = orig_cnum; TALLOC_FREE(frame); @@ -151,9 +149,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, status = NT_STATUS_OK; fail: - if (p != NULL) { - cli_rpc_pipe_close(p); - } + TALLOC_FREE(p); cli_tdis(cli); cli->cnum = orig_cnum; TALLOC_FREE(frame); diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index d2dd1b49d3..c2b364d1e9 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -188,7 +188,7 @@ static bool get_rpc_shares(struct cli_state *cli, if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr)) { TALLOC_FREE(mem_ctx); - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); return False; } @@ -198,7 +198,7 @@ static bool get_rpc_shares(struct cli_state *cli, } TALLOC_FREE(mem_ctx); - cli_rpc_pipe_close(pipe_hnd); + TALLOC_FREE(pipe_hnd); return True; } -- cgit