1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s3:rpc_client: pass remote_{name,sockaddr} to rpccli_setup_netlogon_creds[_locked]()

We shouldd not rely on cli_state to be a valid pointer
(at least not when NCACN_IP_TCP is used...)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-09-27 09:38:19 +02:00 committed by Volker Lendecke
parent c3222192a4
commit 628d7b6f2e
4 changed files with 16 additions and 6 deletions

View File

@ -156,6 +156,8 @@ NTSTATUS rpccli_create_netlogon_creds_ctx(
static NTSTATUS rpccli_setup_netlogon_creds_locked(
struct cli_state *cli,
enum dcerpc_transport_t transport,
const char *remote_name,
const struct sockaddr_storage *remote_sockaddr,
struct netlogon_creds_cli_context *creds_ctx,
bool force_reauth,
struct cli_credentials *cli_creds,
@ -170,8 +172,6 @@ static NTSTATUS rpccli_setup_netlogon_creds_locked(
const struct samr_Password *nt_hashes[2] = { NULL, NULL };
uint8_t idx_nt_hashes = 0;
NTSTATUS status;
const char *remote_name = NULL;
const struct sockaddr_storage *remote_sockaddr = NULL;
status = netlogon_creds_cli_get(creds_ctx, frame, &creds);
if (NT_STATUS_IS_OK(status)) {
@ -210,9 +210,6 @@ static NTSTATUS rpccli_setup_netlogon_creds_locked(
num_nt_hashes = 2;
}
remote_name = smbXcli_conn_remote_name(cli->conn);
remote_sockaddr = smbXcli_conn_remote_sockaddr(cli->conn);
status = cli_rpc_pipe_open_noauth_transport(cli,
transport,
&ndr_table_netlogon,
@ -266,6 +263,8 @@ done:
NTSTATUS rpccli_setup_netlogon_creds(
struct cli_state *cli,
enum dcerpc_transport_t transport,
const char *remote_name,
const struct sockaddr_storage *remote_sockaddr,
struct netlogon_creds_cli_context *creds_ctx,
bool force_reauth,
struct cli_credentials *cli_creds)
@ -286,6 +285,8 @@ NTSTATUS rpccli_setup_netlogon_creds(
status = rpccli_setup_netlogon_creds_locked(cli,
transport,
remote_name,
remote_sockaddr,
creds_ctx,
force_reauth,
cli_creds,
@ -418,6 +419,8 @@ again:
status = rpccli_setup_netlogon_creds_locked(cli,
transport,
remote_name,
remote_sockaddr,
creds_ctx,
true,
trust_creds,

View File

@ -42,6 +42,8 @@ NTSTATUS rpccli_create_netlogon_creds_ctx(
NTSTATUS rpccli_setup_netlogon_creds(
struct cli_state *cli,
enum dcerpc_transport_t transport,
const char *remote_name,
const struct sockaddr_storage *remote_sockaddr,
struct netlogon_creds_cli_context *creds_ctx,
bool force_reauth,
struct cli_credentials *cli_creds);

View File

@ -89,7 +89,10 @@ NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
goto done;
}
status = rpccli_setup_netlogon_creds(cli, transport,
status = rpccli_setup_netlogon_creds(cli,
transport,
remote_name,
remote_sockaddr,
netlogon_creds,
false, /* force_reauth */
cli_creds);

View File

@ -1035,6 +1035,8 @@ static NTSTATUS do_cmd(struct cli_state *cli,
ntresult = rpccli_setup_netlogon_creds(
cli,
NCACN_NP,
remote_name,
remote_sockaddr,
rpcclient_netlogon_creds,
false, /* force_reauth */
trust_creds);