From 898c6123355a3a11ec17f0396c4cb3018c75c184 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 23 Aug 2010 16:02:23 +0200 Subject: s3-dcerpc: avoid talloc_move on schannel creds in cli_rpc_pipe_open_schannel_with_key(). Initially, the schannel creds were talloc memduped, then, during the netlogon creds client merge (baf7274fed2f1ae7a9e3a57160bf5471566e636c) they were first talloc_referenced and then later (53765c81f726a8c056cc4e57004592dd489975c9) talloc_moved. The issue with using talloc_move here is that users of that function in winbind will only be able to have two schanneled connections, as the cached schannel credentials pointer from the netlogon pipe will be set to NULL. Do a deep copy of the struct instead. Guenther --- source3/rpc_client/cli_pipe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index c9b1ef65a0..d57bc0af60 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2383,7 +2383,7 @@ NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain, result->a_u.schannel_auth->state = SCHANNEL_STATE_START; result->a_u.schannel_auth->seq_num = 0; result->a_u.schannel_auth->initiator = true; - result->a_u.schannel_auth->creds = creds; + result->a_u.schannel_auth->creds = netlogon_creds_copy(result, creds); *presult = result; return NT_STATUS_OK; @@ -3048,9 +3048,13 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, /* * The credentials on a new netlogon pipe are the ones we are passed - * in - reference them in + * in - copy them over */ - result->dc = talloc_move(result, pdc); + result->dc = netlogon_creds_copy(result, *pdc); + if (result->dc == NULL) { + TALLOC_FREE(result); + return NT_STATUS_NO_MEMORY; + } DEBUG(10,("cli_rpc_pipe_open_schannel_with_key: opened pipe %s to machine %s " "for domain %s and bound using schannel.\n", -- cgit