X-Git-Url: http://git.samba.org/?p=samba.git;a=blobdiff_plain;f=source3%2Frpc_client%2Fcli_netlogon.c;h=2c3e205e2f4dbb39777acfb3487552118f6f4aca;hp=75234a6799c48f4d6d6ab542748bb6b5748c297c;hb=b62bba83ba8544adfc3700e927247ec942735538;hpb=7a3d1b5a6fcbbd6d12cb3568a7ac62e50c056a5b diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 75234a6799c..2c3e205e2f4 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -157,13 +157,12 @@ NTSTATUS rpccli_create_netlogon_creds_ctx( netlogon_creds); } -static NTSTATUS rpccli_setup_netlogon_creds( +NTSTATUS rpccli_setup_netlogon_creds( struct cli_state *cli, enum dcerpc_transport_t transport, struct netlogon_creds_cli_context *netlogon_creds, bool force_reauth, - struct samr_Password current_nt_hash, - const struct samr_Password *previous_nt_hash) + struct cli_credentials *cli_creds) { TALLOC_CTX *frame = talloc_stackframe(); struct rpc_pipe_client *netlogon_pipe = NULL; @@ -193,6 +192,19 @@ static NTSTATUS rpccli_setup_netlogon_creds( TALLOC_FREE(creds); } + nt_hashes[0] = cli_credentials_get_nt_hash(cli_creds, talloc_tos()); + if (nt_hashes[0] == NULL) { + TALLOC_FREE(frame); + return NT_STATUS_NO_MEMORY; + } + num_nt_hashes = 1; + + nt_hashes[1] = cli_credentials_get_old_nt_hash(cli_creds, + talloc_tos()); + if (nt_hashes[1] != NULL) { + num_nt_hashes = 2; + } + status = cli_rpc_pipe_open_noauth_transport(cli, transport, &ndr_table_netlogon, @@ -207,13 +219,6 @@ static NTSTATUS rpccli_setup_netlogon_creds( } talloc_steal(frame, netlogon_pipe); - nt_hashes[0] = ¤t_nt_hash; - num_nt_hashes = 1; - if (previous_nt_hash != NULL) { - nt_hashes[1] = previous_nt_hash; - num_nt_hashes = 2; - } - status = netlogon_creds_cli_auth(netlogon_creds, netlogon_pipe->binding_handle, num_nt_hashes, @@ -240,37 +245,6 @@ static NTSTATUS rpccli_setup_netlogon_creds( return NT_STATUS_OK; } -NTSTATUS rpccli_setup_netlogon_creds_with_creds(struct cli_state *cli, - enum dcerpc_transport_t transport, - struct netlogon_creds_cli_context *netlogon_creds, - bool force_reauth, - struct cli_credentials *creds) -{ - struct samr_Password *current_nt_hash = NULL; - struct samr_Password *previous_nt_hash = NULL; - NTSTATUS status; - - current_nt_hash = cli_credentials_get_nt_hash(creds, talloc_tos()); - if (current_nt_hash == NULL) { - return NT_STATUS_NO_MEMORY; - } - - previous_nt_hash = cli_credentials_get_old_nt_hash(creds, talloc_tos()); - - status = rpccli_setup_netlogon_creds(cli, transport, - netlogon_creds, - force_reauth, - *current_nt_hash, - previous_nt_hash); - TALLOC_FREE(current_nt_hash); - TALLOC_FREE(previous_nt_hash); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - return NT_STATUS_OK; -} - static NTSTATUS map_validation_to_info3(TALLOC_CTX *mem_ctx, uint16_t validation_level, union netr_Validation *validation,