From: Stefan Metzmacher Date: Wed, 6 Nov 2024 13:16:27 +0000 (+0100) Subject: s3:cli_pipe: pass target_service to cli_rpc_pipe_open_with_creds() X-Git-Tag: samba-4.21.7~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ba2acc9fc9b2f4b15340dc2296bc89aa6b8b6be;p=thirdparty%2Fsamba.git s3:cli_pipe: pass target_service to cli_rpc_pipe_open_with_creds() Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c index 3231d0bfff2..e7482173cef 100644 --- a/source3/libsmb/passchange.c +++ b/source3/libsmb/passchange.c @@ -163,6 +163,7 @@ NTSTATUS remote_password_change(const char *remote_machine, NCACN_NP, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_PRIVACY, + NULL, /* target_service */ remote_machine, remote_sockaddr, creds, diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 188b7fe2838..4c70c406dbd 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -4265,20 +4265,24 @@ NTSTATUS cli_rpc_pipe_open_with_creds(struct cli_state *cli, enum dcerpc_transport_t transport, enum dcerpc_AuthType auth_type, enum dcerpc_AuthLevel auth_level, - const char *server, + const char *target_service, + const char *target_hostname, const struct sockaddr_storage *remote_sockaddr, struct cli_credentials *creds, struct rpc_pipe_client **presult) { struct rpc_pipe_client *result; struct pipe_auth_data *auth = NULL; - const char *target_service = table->authservices->names[0]; NTSTATUS status; + if (target_service == NULL) { + target_service = table->authservices->names[0]; + } + status = cli_rpc_pipe_open(cli, transport, table, - server, + target_hostname, remote_sockaddr, &result); if (!NT_STATUS_IS_OK(status)) { @@ -4286,8 +4290,10 @@ NTSTATUS cli_rpc_pipe_open_with_creds(struct cli_state *cli, } status = rpccli_generic_bind_data_from_creds(result, - auth_type, auth_level, - server, target_service, + auth_type, + auth_level, + target_hostname, + target_service, creds, &auth); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/rpc_client/cli_pipe.h b/source3/rpc_client/cli_pipe.h index 2639cba884f..d6e472afcf6 100644 --- a/source3/rpc_client/cli_pipe.h +++ b/source3/rpc_client/cli_pipe.h @@ -104,7 +104,8 @@ NTSTATUS cli_rpc_pipe_open_with_creds(struct cli_state *cli, enum dcerpc_transport_t transport, enum dcerpc_AuthType auth_type, enum dcerpc_AuthLevel auth_level, - const char *server, + const char *target_service, + const char *target_hostname, const struct sockaddr_storage *remote_sockaddr, struct cli_credentials *creds, struct rpc_pipe_client **presult); diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 95b6baf32b0..b81020482e6 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -958,6 +958,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, transport, auth_type, auth_level, + NULL, /* target_service */ remote_name, remote_sockaddr, creds, diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 4e4de84b6e3..86cd9a5600b 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -214,6 +214,7 @@ int run_rpc_command(struct net_context *c, NCACN_IP_TCP : NCACN_NP, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_PRIVACY, + NULL, /* target_service */ smbXcli_conn_remote_name(cli->conn), smbXcli_conn_remote_sockaddr(cli->conn), c->creds, &pipe_hnd); diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 9d59876970a..e07b6fb0f32 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -2639,6 +2639,7 @@ retry: NCACN_NP, DCERPC_AUTH_TYPE_SPNEGO, conn->auth_level, + NULL, /* target_service */ remote_name, remote_sockaddr, creds, @@ -2974,6 +2975,7 @@ retry: (conn->cli, &ndr_table_lsarpc, NCACN_NP, DCERPC_AUTH_TYPE_SPNEGO, conn->auth_level, + NULL, /* target_service */ remote_name, remote_sockaddr, creds,