summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-04-20 13:51:46 +0200
committerVolker Lendecke <vl@samba.org>2008-04-20 14:08:16 +0200
commite73e8297f5484b6c7f525917679414c09a145cf0 (patch)
treead69021ee87c51500ddafbf3fc9aad96e05243d9
parent33592bdcb97c05a85a9c5a8e11b351d63c326f0e (diff)
downloadsamba-e73e8297f5484b6c7f525917679414c09a145cf0.tar.gz
samba-e73e8297f5484b6c7f525917679414c09a145cf0.tar.xz
samba-e73e8297f5484b6c7f525917679414c09a145cf0.zip
Replace cli_rpc_pipe_close by a talloc destructor on rpc_pipe_struct
(This used to be commit 99fc3283c4ecc791f5a242bd1983b4352ce3e6cf)
-rw-r--r--source3/client/client.c4
-rw-r--r--source3/libnet/libnet_join.c6
-rw-r--r--source3/libsmb/clientgen.c48
-rw-r--r--source3/libsmb/libsmb_dir.c2
-rw-r--r--source3/libsmb/passchange.c2
-rw-r--r--source3/rpc_client/cli_pipe.c57
-rw-r--r--source3/rpcclient/cmd_test.c4
-rw-r--r--source3/rpcclient/rpcclient.c6
-rw-r--r--source3/utils/net_rpc.c18
-rw-r--r--source3/utils/net_rpc_join.c8
-rw-r--r--source3/utils/net_rpc_shell.c2
-rw-r--r--source3/utils/net_util.c2
-rw-r--r--source3/utils/smbcacls.c8
-rw-r--r--source3/utils/smbtree.c4
-rw-r--r--source3/winbindd/winbindd_cm.c52
15 files changed, 102 insertions, 121 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 1c9c21e979f..b4e1985a837 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3658,7 +3658,7 @@ static bool browse_host_rpc(bool sort)
&werr);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr)) {
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
TALLOC_FREE(frame);
return false;
}
@@ -3668,7 +3668,7 @@ static bool browse_host_rpc(bool sort)
browse_fn(info.name, info.type, info.comment, NULL);
}
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
TALLOC_FREE(frame);
return true;
}
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 207a3acfa85..d22fbc21b93 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -706,7 +706,7 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx,
}
rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
done:
return status;
@@ -951,7 +951,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
if (is_valid_policy_hnd(&user_pol)) {
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
}
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
return status;
}
@@ -1217,7 +1217,7 @@ done:
if (pipe_hnd) {
rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
}
if (cli) {
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index ef2c2639cd5..e64b6fa278a 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -617,54 +617,16 @@ struct cli_state *cli_initialise(void)
}
/****************************************************************************
- External interface.
- Close an open named pipe over SMB. Free any authentication data.
- Returns false if the cli_close call failed.
- ****************************************************************************/
-
-bool cli_rpc_pipe_close(struct rpc_pipe_client *cli)
-{
- bool ret;
-
- if (!cli) {
- return false;
- }
-
- ret = cli_close(cli->cli, cli->fnum);
-
- if (!ret) {
- DEBUG(1,("cli_rpc_pipe_close: cli_close failed on pipe %s, "
- "fnum 0x%x "
- "to machine %s. Error was %s\n",
- cli->pipe_name,
- (int) cli->fnum,
- cli->desthost,
- cli_errstr(cli->cli)));
- }
-
- if (cli->auth.cli_auth_data_free_func) {
- (*cli->auth.cli_auth_data_free_func)(&cli->auth);
- }
-
- DEBUG(10,("cli_rpc_pipe_close: closed pipe %s to machine %s\n",
- cli->pipe_name, cli->desthost ));
-
- DLIST_REMOVE(cli->cli->pipe_list, cli);
- talloc_destroy(cli);
- return ret;
-}
-
-/****************************************************************************
Close all pipes open on this session.
****************************************************************************/
void cli_nt_pipes_close(struct cli_state *cli)
{
- struct rpc_pipe_client *cp, *next;
-
- for (cp = cli->pipe_list; cp; cp = next) {
- next = cp->next;
- cli_rpc_pipe_close(cp);
+ while (cli->pipe_list != NULL) {
+ /*
+ * No TALLOC_FREE here!
+ */
+ talloc_free(cli->pipe_list);
}
}
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 612a8772c0e..aea4f103b6f 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -319,7 +319,7 @@ net_share_enum_rpc(struct cli_state *cli,
done:
/* Close the server service pipe */
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
/* Tell 'em if it worked */
return W_ERROR_IS_OK(result) ? 0 : -1;
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index 2f9a87dee4a..8f7cbf265e9 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -196,7 +196,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
}
/* OK, that failed, so try again... */
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
/* Try anonymous NTLMSSP... */
cli_init_creds(cli, "", "", NULL);
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 3e03887bfdb..b0d6f8eafd6 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -1066,7 +1066,10 @@ static NTSTATUS create_schannel_auth_rpc_bind_req( struct rpc_pipe_client *cli,
/* Use lp_workgroup() if domain not specified */
if (!cli->domain || !cli->domain[0]) {
- cli->domain = lp_workgroup();
+ cli->domain = talloc_strdup(cli, lp_workgroup());
+ if (cli->domain == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
}
init_rpc_auth_schannel_neg(&schannel_neg, cli->domain, global_myname());
@@ -2137,6 +2140,30 @@ bool rpccli_is_pipe_idx(struct rpc_pipe_client *cli, int pipe_idx)
return (cli->abstract_syntax == pipe_names[pipe_idx].abstr_syntax);
}
+static int rpc_pipe_destructor(struct rpc_pipe_client *p)
+{
+ bool ret;
+
+ ret = cli_close(p->cli, p->fnum);
+ if (!ret) {
+ DEBUG(1, ("rpc_pipe_destructor: cli_close failed on pipe %s, "
+ "fnum 0x%x to machine %s. Error was %s\n",
+ p->pipe_name, (int) p->fnum,
+ p->desthost, cli_errstr(p->cli)));
+ }
+
+ if (p->auth.cli_auth_data_free_func) {
+ (*p->auth.cli_auth_data_free_func)(&p->auth);
+ }
+
+ DEBUG(10, ("rpc_pipe_destructor: closed pipe %s to machine %s\n",
+ p->pipe_name, p->desthost ));
+
+ DLIST_REMOVE(p->cli->pipe_list, p);
+
+ return ret ? -1 : 0;
+}
+
/****************************************************************************
Open a named pipe over SMB to a remote server.
*
@@ -2220,6 +2247,8 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
result->fnum = fnum;
DLIST_ADD(cli->pipe_list, result);
+ talloc_set_destructor(result, rpc_pipe_destructor);
+
*perr = NT_STATUS_OK;
return result;
@@ -2248,7 +2277,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe
}
DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe %s failed with error %s\n",
cli_get_pipe_name(pipe_idx), nt_errstr(*perr) ));
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
return NULL;
}
@@ -2360,7 +2389,7 @@ static struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_internal(struct cli_sta
err:
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
return NULL;
}
@@ -2481,7 +2510,7 @@ struct rpc_pipe_client *get_schannel_session_key(struct cli_state *cli,
if (!get_schannel_session_key_common(netlogon_pipe, cli, domain,
pneg_flags, perr))
{
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return NULL;
}
@@ -2511,7 +2540,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cl
result->auth.a_u.schannel_auth = TALLOC_ZERO_P(
result, struct schannel_auth_struct);
if (!result->auth.a_u.schannel_auth) {
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
*perr = NT_STATUS_NO_MEMORY;
return NULL;
}
@@ -2519,7 +2548,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cl
TALLOC_FREE(result->domain);
result->domain = talloc_strdup(result, domain);
if (result->domain == NULL) {
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
*perr = NT_STATUS_NO_MEMORY;
return NULL;
}
@@ -2530,7 +2559,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cl
if (!NT_STATUS_IS_OK(*perr)) {
DEBUG(0, ("cli_rpc_pipe_open_schannel_with_key: cli_rpc_pipe_bind failed with error %s\n",
nt_errstr(*perr) ));
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
return NULL;
}
@@ -2570,7 +2599,7 @@ static struct rpc_pipe_client *get_schannel_session_key_auth_ntlmssp(struct cli_
if (!get_schannel_session_key_common(netlogon_pipe, cli, domain,
pneg_flags, perr))
{
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return NULL;
}
@@ -2609,7 +2638,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state
domain, netlogon_pipe->dc, perr);
/* Now we've bound using the session key we can close the netlog pipe. */
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return result;
}
@@ -2642,7 +2671,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_schannel(struct cli_state *cli,
domain, netlogon_pipe->dc, perr);
/* Now we've bound using the session key we can close the netlog pipe. */
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return result;
}
@@ -2687,7 +2716,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
service_princ = talloc_asprintf(result, "%s$@%s",
cli->desthost, lp_realm() );
if (!service_princ) {
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
return NULL;
}
}
@@ -2696,7 +2725,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
if (username && password) {
int ret = kerberos_kinit_password(username, password, 0, NULL);
if (ret) {
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
return NULL;
}
}
@@ -2704,7 +2733,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
result->auth.a_u.kerberos_auth = TALLOC_ZERO_P(
result, struct kerberos_auth_struct);
if (!result->auth.a_u.kerberos_auth) {
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
*perr = NT_STATUS_NO_MEMORY;
return NULL;
}
@@ -2716,7 +2745,7 @@ struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
if (!NT_STATUS_IS_OK(*perr)) {
DEBUG(0, ("cli_rpc_pipe_open_krb5: cli_rpc_pipe_bind failed with error %s\n",
nt_errstr(*perr) ));
- cli_rpc_pipe_close(result);
+ TALLOC_FREE(result);
return NULL;
}
diff --git a/source3/rpcclient/cmd_test.c b/source3/rpcclient/cmd_test.c
index 089d7bcaa3f..f9ea5c0fc2d 100644
--- a/source3/rpcclient/cmd_test.c
+++ b/source3/rpcclient/cmd_test.c
@@ -48,8 +48,8 @@ static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
goto done;
done:
- if (lsa_pipe != NULL) cli_rpc_pipe_close(lsa_pipe);
- if (samr_pipe != NULL) cli_rpc_pipe_close(samr_pipe);
+ TALLOC_FREE(lsa_pipe);
+ TALLOC_FREE(samr_pipe);
return status;
}
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 8592e0a3b60..ebd38044b84 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -169,7 +169,7 @@ static void fetch_machine_sid(struct cli_state *cli)
sid_copy(&domain_sid, info->account_domain.sid);
rpccli_lsa_Close(lsapipe, mem_ctx, &pol);
- cli_rpc_pipe_close(lsapipe);
+ TALLOC_FREE(lsapipe);
talloc_destroy(mem_ctx);
return;
@@ -177,7 +177,7 @@ static void fetch_machine_sid(struct cli_state *cli)
error:
if (lsapipe) {
- cli_rpc_pipe_close(lsapipe);
+ TALLOC_FREE(lsapipe);
}
fprintf(stderr, "could not obtain sid for domain %s\n", cli->domain);
@@ -336,7 +336,7 @@ static NTSTATUS cmd_set_ss_level(void)
if (tmp_set->rpc_pipe->auth.auth_type != pipe_default_auth_type ||
tmp_set->rpc_pipe->auth.auth_level != pipe_default_auth_level) {
- cli_rpc_pipe_close(tmp_set->rpc_pipe);
+ TALLOC_FREE(tmp_set->rpc_pipe);
tmp_set->rpc_pipe = NULL;
}
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 330317b0fd5..f6f0c4054ca 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 b868ea824fb..c94e9d1a408 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 e6302b652ed..7bd726e614f 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 f844992d562..576c2191b31 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 134f5617603..af14c622dc9 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 d2dd1b49d32..c2b364d1e9a 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;
}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 8fcbae77ff7..73f74ca8ec0 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1432,33 +1432,27 @@ void invalidate_cm_connection(struct winbindd_cm_conn *conn)
}
if (conn->samr_pipe != NULL) {
- if (!cli_rpc_pipe_close(conn->samr_pipe)) {
- /* Ok, it must be dead. Drop timeout to 0.5 sec. */
- if (conn->cli) {
- cli_set_timeout(conn->cli, 500);
- }
+ TALLOC_FREE(conn->samr_pipe);
+ /* Ok, it must be dead. Drop timeout to 0.5 sec. */
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 500);
}
- conn->samr_pipe = NULL;
}
if (conn->lsa_pipe != NULL) {
- if (!cli_rpc_pipe_close(conn->lsa_pipe)) {
- /* Ok, it must be dead. Drop timeout to 0.5 sec. */
- if (conn->cli) {
- cli_set_timeout(conn->cli, 500);
- }
+ TALLOC_FREE(conn->lsa_pipe);
+ /* Ok, it must be dead. Drop timeout to 0.5 sec. */
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 500);
}
- conn->lsa_pipe = NULL;
}
if (conn->netlogon_pipe != NULL) {
- if (!cli_rpc_pipe_close(conn->netlogon_pipe)) {
- /* Ok, it must be dead. Drop timeout to 0.5 sec. */
- if (conn->cli) {
- cli_set_timeout(conn->cli, 500);
- }
+ TALLOC_FREE(conn->netlogon_pipe);
+ /* Ok, it must be dead. Drop timeout to 0.5 sec. */
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 500);
}
- conn->netlogon_pipe = NULL;
}
if (conn->cli) {
@@ -1711,7 +1705,7 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
DS_ROLE_BASIC_INFORMATION,
&info,
&werr);
- cli_rpc_pipe_close(cli);
+ TALLOC_FREE(cli);
if (!NT_STATUS_IS_OK(result)) {
DEBUG(5, ("set_dc_type_and_flags_connect: rpccli_ds_getprimarydominfo "
@@ -1745,7 +1739,7 @@ no_dssetup:
DEBUG(5, ("set_dc_type_and_flags_connect: Could not bind to "
"PI_LSARPC on domain %s: (%s)\n",
domain->name, nt_errstr(result)));
- cli_rpc_pipe_close(cli);
+ TALLOC_FREE(cli);
TALLOC_FREE(mem_ctx);
return;
}
@@ -1825,7 +1819,7 @@ done:
DEBUG(5,("set_dc_type_and_flags_connect: domain %s is %srunning active directory.\n",
domain->name, domain->active_directory ? "" : "NOT "));
- cli_rpc_pipe_close(cli);
+ TALLOC_FREE(cli);
TALLOC_FREE(mem_ctx);
@@ -1971,7 +1965,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
DEBUG(10,("cm_connect_sam: ntlmssp-sealed rpccli_samr_Connect2 "
"failed for domain %s, error was %s. Trying schannel\n",
domain->name, nt_errstr(result) ));
- cli_rpc_pipe_close(conn->samr_pipe);
+ TALLOC_FREE(conn->samr_pipe);
schannel:
@@ -2006,7 +2000,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
DEBUG(10,("cm_connect_sam: schannel-sealed rpccli_samr_Connect2 failed "
"for domain %s, error was %s. Trying anonymous\n",
domain->name, nt_errstr(result) ));
- cli_rpc_pipe_close(conn->samr_pipe);
+ TALLOC_FREE(conn->samr_pipe);
anonymous:
@@ -2108,7 +2102,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
DEBUG(10,("cm_connect_lsa: rpccli_lsa_open_policy failed, trying "
"schannel\n"));
- cli_rpc_pipe_close(conn->lsa_pipe);
+ TALLOC_FREE(conn->lsa_pipe);
schannel:
@@ -2143,7 +2137,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
DEBUG(10,("cm_connect_lsa: rpccli_lsa_open_policy failed, trying "
"anonymous\n"));
- cli_rpc_pipe_close(conn->lsa_pipe);
+ TALLOC_FREE(conn->lsa_pipe);
anonymous:
@@ -2218,7 +2212,7 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
if (!get_trust_pw_hash(domain->name, mach_pwd, &account_name,
&sec_chan_type))
{
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
}
@@ -2233,14 +2227,14 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
&neg_flags);
if (!NT_STATUS_IS_OK(result)) {
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return result;
}
if ((lp_client_schannel() == True) &&
((neg_flags & NETLOGON_NEG_SCHANNEL) == 0)) {
DEBUG(3, ("Server did not offer schannel\n"));
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
return NT_STATUS_ACCESS_DENIED;
}
@@ -2273,7 +2267,7 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
&result);
/* We can now close the initial netlogon pipe. */
- cli_rpc_pipe_close(netlogon_pipe);
+ TALLOC_FREE(netlogon_pipe);
if (conn->netlogon_pipe == NULL) {
DEBUG(3, ("Could not open schannel'ed NETLOGON pipe. Error "