From e9c8e3fb92143525f846523e446e2213e5b55d9d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 25 Apr 2013 19:45:52 +0200 Subject: s3:rpc_client: use netlogon_creds_copy before rpc_pipe_bind Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source3/rpc_client/cli_pipe.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 477853494a..8775c3b03d 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -3019,6 +3019,18 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, return status; } + /* + * The credentials on a new netlogon pipe are the ones we are passed + * in - copy them over + * + * This may get overwritten... in rpc_pipe_bind()... + */ + rpccli->dc = netlogon_creds_copy(rpccli, *pdc); + if (rpccli->dc == NULL) { + TALLOC_FREE(rpccli); + return NT_STATUS_NO_MEMORY; + } + status = rpc_pipe_bind(rpccli, rpcauth); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("cli_rpc_pipe_open_schannel_with_key: " @@ -3028,18 +3040,6 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, return status; } - /* - * The credentials on a new netlogon pipe are the ones we are passed - * in - copy them over - */ - if (rpccli->dc == NULL) { - rpccli->dc = netlogon_creds_copy(rpccli, *pdc); - if (rpccli->dc == NULL) { - TALLOC_FREE(rpccli); - 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", get_pipe_name_from_syntax(talloc_tos(), &table->syntax_id), -- cgit