summaryrefslogtreecommitdiff
path: root/source3/rpc_client
AgeCommit message (Collapse)AuthorFilesLines
2026-01-27s3:rpc_client: Fix memory leak opening local named pipeSamuel Cabrero1-1/+1
If no local server name was passed to rpc_pipe_open_local_np() then get_myname() was called with NULL talloc context instead of the current stackframe. This was causing an increase of memory usage on busy servers with long-living rpcd_* workers. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15979 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Noel Power <noel.power@suse.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jan 27 10:13:40 UTC 2026 on atb-devel-224
2026-01-13lib/async_req: let async_connect_send() pass the fd to ↵Stefan Metzmacher1-4/+4
{before,after}_connect hooks This will be useful for IPPROTO_SMBDIRECT sockets to setup things between the socket() and connect() syscalls. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-12-08auth: Use new data_blob_..._s() functions and remove talloc_keep_secret()Pavel Filipenský1-2/+1
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-10s3: Replace a few calls to TALLOC() with talloc_array()Volker Lendecke2-3/+3
No explicit cast necessary Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-16libsmb: Remove "source3/libsmb/libsmb.h"Volker Lendecke3-3/+2
libsmb.h added ads_status.h and cli_smb2_fnum.h. Only few users need either. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-17s3:rpc_client: Use cli_rpc_pipe_reopen_np_noauth() for OpenPolicy fallbackStefan Metzmacher2-3/+16
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-02-17s3:rpc_client: Add cli_rpc_pipe_reopen_np_noauth()Stefan Metzmacher2-0/+90
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-01-29s3:rpc_client: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) ↵Stefan Metzmacher1-1/+1
rpccli_bh_do_ndr_print This makes sure the debug class rpc_parse is used for ndr dump output. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-13s3:cli_netlogon: prepare for netr_ServerAuthenticateKerberos()Stefan Metzmacher2-1/+94
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13s3:cli_netlogon: use GENSEC_FEATURE_NO_DELEGATION for trust credentialsStefan Metzmacher1-0/+5
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2024-12-05s3:cli_pipe: pass target_service to cli_rpc_pipe_open_with_creds()Stefan Metzmacher2-6/+13
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-05s3:rpc_client: remember the local/remote ipv4 or ipv6 addressesStefan Metzmacher1-6/+56
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-31s3:cli_netlogon: don't change remote_name in ↵Stefan Metzmacher1-6/+0
rpccli_setup_netlogon_creds_locked() This was missing in commit 628d7b6f2e626c9c530473d06c038dfec9cbd17a. We should not alter the name to '<UNKNOWN>'! Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-30s3:cli_netlogon: let rpccli_connect_netlogon() use force_reauth = true on retryStefan Metzmacher1-0/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-09-29s3:rpc_client: pass remote_{name,sockaddr} to ↵Stefan Metzmacher3-6/+14
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>
2024-09-29s3:rpc_client: add missing TALLOC_FREE(frame) in cli_rpc_pipe_open()Stefan Metzmacher1-0/+1
This was missing in commit 637a8e5270fefaea5c61921d4b6ecfc4455a91aa. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-09-26s3:rpc_client: let cli_rpc_pipe_open_schannel() use ↵Stefan Metzmacher1-0/+17
rpccli_connect_netlogon() for netlogon This way we could reuse the connection already created... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: pass remote_{name,sockaddr} to rpccli_connect_netlogon()Stefan Metzmacher2-5/+4
Otherwise this can only work with NCACN_NP... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: let rpccli_connect_netlogon() reuse the existing connectionStefan Metzmacher1-21/+21
We either use security context multiplexing if negotiated and just do an alter_context on the existing connection or we create a new connection within the same association group. This is basically what windows clients are doing... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: allow rpccli_setup_netlogon_creds_locked() to return ↵Stefan Metzmacher1-5/+22
netlogon_pipe Let the caller decide if it wants to keep the netlogon connection... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: make rpccli_setup_netlogon_creds_locked() staticStefan Metzmacher2-8/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: split out cli_rpc_pipe_client_auth_schannel()Stefan Metzmacher2-27/+49
This will allow us to use it without creating a new association group and transport connection. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: add cli_rpc_pipe_client_prepare_alter() helperStefan Metzmacher2-0/+86
This will allow to do an alter context if security context multiplexing is negotiated or opening a new connection in the same association group. The old connection will be kept open, but not used anymore... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: make real use of rpc_client_{association,connection}Stefan Metzmacher2-118/+331
This will allow NCACN_NP and NCACN_IP_TCP to support alter_context with security context multiplexing or otherwise more than one connection per association group. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: let cli_rpc_pipe_open() use rpc_client_connection_np()Stefan Metzmacher2-31/+35
This way cli_rpc_pipe_open() uses the same flow for rpc_client_connection_np() and rpc_pipe_open_tcp_port(). Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: convert rpc_pipe_open_np() to rpc_client_{association,connection}Stefan Metzmacher1-81/+129
This split out rpc_client_connection_np_send/recv, which will be used as shortcut in a later commit. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: convert rpc_pipe_open_tcp_port() to ↵Stefan Metzmacher1-102/+179
rpc_client_{association,connection} Note that cli_rpc_pipe_open() calls rpc_client_association_create() without a need for NCACN_NP, but that will change in the next commits... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: convert rpc_pipe_open_local_np() to ↵Stefan Metzmacher1-38/+63
rpc_client_{association,connection} For rpc_pipe_open_local_np() it's not really important to abstract these out, but we want to have these for all... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: convert rpc_pipe_open_ncalrpc() to ↵Stefan Metzmacher1-44/+53
rpc_client_{association,connection} For rpc_pipe_open_ncalrpc() it's not really important to abstract these out, but we want to have these for all... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: add struct rpc_client_{association,connection} and helpersStefan Metzmacher2-2/+160
They will be every useful for NCACN_NP and NCACN_IP_TCP, so that we can support alter_context or more than one connection per association group. We mark the helpers as _UNUSED_ for now in order to compile... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: only pass the pipe_name to rpc_transport_np_init_send()Stefan Metzmacher4-8/+13
There's no need to have the ndr_interface_table at that stage... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: make most of rpc_pipe_client internal struct membersStefan Metzmacher2-5/+20
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:librpc/rpc: split out dcerpc_internal.h for struct pipe_auth_dataStefan Metzmacher1-0/+1
This should be anonymous for callers. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: remove references to rpc_pipe_client from wsp_cli.cStefan Metzmacher1-26/+45
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: remember rpc_pipe_client->print_usernameStefan Metzmacher3-4/+12
This is ugly, but it's less ugly than doing it deep inside of cli_spoolss.c and other code. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: implement rpccli_bh_get_binding()Stefan Metzmacher1-2/+42
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: header signing is negotiated per transport connectionStefan Metzmacher2-23/+15
All gensec backends support GENSEC_FEATURE_SIGN_PKT_HEADER, so there's no point in negotiating header signing based on the auth context used during the DCERPC Bind. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: make use of struct samba_sockaddr in rpc_pipe_open_ncalrpc()Stefan Metzmacher1-7/+13
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: the transport_session_key is per connection!Stefan Metzmacher2-12/+6
It's not per auth_context_id, currently there's no difference but that will change in future... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: remove unused cli_get_session_key()Stefan Metzmacher2-53/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: add rpccli_bh_auth_session_key()Stefan Metzmacher1-0/+39
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:rpc_client: add rpccli_bh_transport_session_key()Stefan Metzmacher1-0/+35
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-07-26s3/rpc_client: fix handling of NT_STATUS_SOME_NOT_MAPPEDRalph Boehme1-4/+15
In this case names that couldn't be resolved will be have a NULL sid pointer which would trigger a crash in sid_copy(). Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2024-06-30s3:rpc_client: Initialize struct security_aceAndreas Schneider1-1/+1
"Error: UNINIT (CWE-457): samba-4.20.0rc2/source3/rpc_client/init_spoolss.c:348: var_decl: Declaring variable ""ace"" without initializer. samba-4.20.0rc2/source3/rpc_client/init_spoolss.c:415: uninit_use_in_call: Using uninitialized value ""*ace"". Field ""ace->object"" is uninitialized when calling ""make_sec_acl"". 413| NT5 machine. */ 414| 415|-> if ((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, i, ace)) != NULL) { 416| psd = make_sec_desc(mem_ctx, 417| SD_REVISION," Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2024-06-28s3:rpc_client: Check for array size instead of UINT16_MAXAndreas Schneider1-1/+3
mdscli_ctx->mdscmd_open.share_path is an array of size 1025. The boundary is 1025 and not UINT16_MAX. "Error: OVERRUN (CWE-119): samba-4.20.0rc2/source3/rpc_client/cli_mdssvc.c:127: cond_at_least: Checking ""share_path_len < 1UL"" implies that ""share_path_len"" is at least 1 on the false branch. samba-4.20.0rc2/source3/rpc_client/cli_mdssvc.c:127: cond_between: Checking ""share_path_len > 65535UL"" implies that ""share_path_len"" is between 1 and 65535 (inclusive) on the false branch. samba-4.20.0rc2/source3/rpc_client/cli_mdssvc.c:133: overrun-local: Overrunning array ""mdscli_ctx->mdscmd_open.share_path"" of 1025 bytes at byte offset 65534 using index ""share_path_len - 1UL"" (which evaluates to 65534). 131| mdscli_ctx->mdscmd_open.share_path_len = share_path_len; 132| 133|-> if (mdscli_ctx->mdscmd_open.share_path[share_path_len-1] == '/') { 134| mdscli_ctx->mdscmd_open.share_path[share_path_len-1] = '\0'; 135| mdscli_ctx->mdscmd_open.share_path_len--;" Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2024-04-23s3:rpc_client: implement bind time feature negotiationStefan Metzmacher2-7/+37
This is not strictly needed as we don't use any of the optional features yet. But it will make it easier to add bind time features we'll actually use later. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Apr 23 17:29:55 UTC 2024 on atb-devel-224
2024-04-23s3:rpc_client: require DCERPC_BIND_ACK_RESULT_ACCEPTANCE for the negotiated ↵Stefan Metzmacher1-3/+4
presentation context We should fail if we didn't get DCERPC_BIND_ACK_RESULT_ACCEPTANCE. It's also not needed to require a single array element. We already checked above that we have at least one. The next patch will all bind time feature negotiation and that means we'll have 2 array elements... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-23s3:rpc_client: pass struct rpc_pipe_client to check_bind_response()Stefan Metzmacher1-2/+3
This prepares adding bind time feature negotiation in the next commits. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09s3:rpc_client: Implement rpc_lsa_encrypt_trustdom_info_aes()Andreas Schneider2-0/+185
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09s3:rpc_client: Implement rpc_lsa_encrypt_trustdom_info()Andreas Schneider2-1/+170
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>