summaryrefslogtreecommitdiff
path: root/libcli/smb
AgeCommit message (Collapse)AuthorFilesLines
2026-03-31libcli/smb: Call data_blob_clear() to zero MAC signing keyPavel Filipenský1-0/+2
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2026-03-31auth: Use secure variant data_blob_talloc_s() to zero sensitive data blobsPavel Filipenský1-15/+16
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2026-01-07lib: Move a few smb-related constant #defines to common codeVolker Lendecke1-0/+45
No need to have two copies in source3 and source4 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 7 11:00:48 UTC 2026 on atb-devel-224
2026-01-07libcli: Initialize a variable at declaration timeVolker Lendecke1-3/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-12-08auth: Use new data_blob_..._s() functions and remove talloc_keep_secret()Pavel Filipenský1-4/+2
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-09-02libsmb: Remove sync smb1cli_trans and _echo wrappersVolker Lendecke3-113/+0
Unused. If someone wants them back, they're easy to recreate Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02libsmb: Use tevent_req_nterror() properlyVolker Lendecke1-2/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-08-22libsmb: Avoid smb-level encryption if quic is trustedVolker Lendecke1-3/+19
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Fri Aug 22 14:55:47 UTC 2025 on atb-devel-224
2025-08-22libsmb: Add "smb_encryption_over_quic" to smb311_capabilitiesVolker Lendecke2-6/+12
Put here from the "client smb encryption over quic" settings Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-08-22libsmb: Negotiate SMB2_ACCEPT_TRANSPORT_LEVEL_SECURITY over quicVolker Lendecke1-0/+40
If we trust quic, indicate to the server that we do so. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-08-22libcli: Add tls_verify_peer_state to smbXcli_transportVolker Lendecke2-23/+38
We have to carry a copy over from the tstream_tls_params used to connect, we can't get this information out once the tls-protected tstream is established Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-08-22libcli: Introduce helper var in smbXcli_negprot_smb2_subreq()Volker Lendecke1-20/+30
Saves a few bytes of code Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-08-13libcli/smb: Fix CID #710784 Resource leakGünther Deschner1-0/+1
buf was (re-)allocated on NULL context thus not part of frame that is freed. Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-07-22libcli/smb: use talloc_asprintf_addbuf() in smbXcli_session_dump_keys()Ralph Boehme1-22/+63
Avoids DEBUGADD() which can lead to intersected output in the logfile. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jul 22 15:09:11 UTC 2025 on atb-devel-224
2025-07-22libcli/smb2: dump encryption key in format for Wireshark ↵Ralph Boehme2-2/+47
~/.wireshark/smb2_seskey_list This allows dumping the keys and quickly feeding them into Wireshark by adding them to ~/.wireshark/smb2_seskey_list. Example: debug encryption: dumping generated session keys Session Id [0000] 7D 00 00 E8 57 E0 31 01 }...W.1. Session Key [0000] 71 54 77 50 C1 DD 66 68 A8 51 D8 DE 23 F4 91 01 qTwP..fh .Q..#... Signing Key [0000] B1 29 AC EF 41 30 AE D2 43 00 1F 67 87 29 BF DB .)..A0.. C..g.).. App Key [0000] 6A 88 5C 51 51 22 FF 5C 25 95 A2 5C E2 2C FC 5D j.\QQ".\ %..\.,.] ServerIn Key [0000] 20 08 EB A2 14 99 17 03 9C A5 9A BB B8 48 88 3C ....... .....H.< ServerOut Key [0000] 15 AA C2 0D 19 AB 4C 26 64 E8 FC 94 B1 FE 27 5A ......L& d.....'Z Wireshark configuration line 7d0000e857e03101,71547750c1dd6668a851d8de23f49101,15aac20d19ab4c2664e8fc94b1fe275a,2008eba2149917039ca59abbb848883c When setting debug encryption = yes debug encryption:wireshark keyfile = /home/slow/.wireshark/smb2_seskey_list the keys are appended directly to Wireshark's keyfile. Wireshark has to be restarted to pick them up. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-07-22libcli/smb: also dump signing_algo in smbXcli_session_dump_keys()Ralph Boehme2-0/+3
The server side already does that and I'm aiming for consolidating server and client code for dumping the keys. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-07-22libcli/smb: make smbXcli_session_dump_keys() usable for the server sideRalph Boehme2-42/+18
By passing the individual keys directly instead of passing the wrapping state objects, smbXcli_session_dump_keys() can later also be used by the server code. No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-07-22libcli/smb: move cli_session_dump_keys() to libsmbRalph Boehme2-0/+55
More callers to come... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-07-17libcli/smb: define SMB_TRANSPORT_TYPE_QUICStefan Metzmacher1-0/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-06-18libcli/smb: add smbXcli_transport_bsd_tstream()Stefan Metzmacher2-0/+47
This can be used to force the usage of the tstream code path even for bsd sockets. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: add smbXcli_transport_tstream()Stefan Metzmacher3-2/+131
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: make read_smb_more non-staticStefan Metzmacher2-2/+3
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: abstract transport function callsStefan Metzmacher1-31/+127
In future we'll have transports without a bsd socket fd. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: add smbXcli_conn_monitor_{send,recv,once}()Stefan Metzmacher2-0/+185
smbXcli_conn_monitor_{send,recv} can be used to monitor a connection over a long time. It will only come back if there's a connection error. smbXcli_conn_monitor_once() will be used by sync callers without a long term tevent context and needs to be called multiple times per second in order to work correctly. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: let smbXcli_transport_bsd() take an fd by referenceStefan Metzmacher2-2/+4
This allows it to set the callers value to -1 when it was moved. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: pass smbXcli_transport to smbXcli_conn_create()Stefan Metzmacher2-7/+3
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: let smbXcli_conn_create() call smbXcli_transport_bsd()Stefan Metzmacher1-39/+38
The next step will pass struct smbXcli_transport from the caller. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: introduce smbXcli_transport_bsdStefan Metzmacher2-0/+63
The next commits will pass an smbXcli_transport to smbXcli_conn_create() instead of a plain 'int fd'. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18libcli/smb: merge smb_transport library into cli_smb_commonStefan Metzmacher1-14/+4
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-14libcli: Avoid a ZERO_STRUCT with a direct initializationVolker Lendecke1-3/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2025-05-19libcli/smb: create explicit talloc stackframe in reparse_data_buffer_marshall()Stefan Metzmacher1-0/+2
This is needed in order to allow helper functions to use talloc_tos(). Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-05-15libsmb: Move 192 bytes from R/W .data to R/O (shared) .textVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-04-18docs-xml/smbdotconf: add 'client smb transports' optionStefan Metzmacher1-75/+0
This will replace the use of 'smb ports' for source4 clients. In future it will be used for all smb client connections and it will allow to add other transports as 'quic' or 'smbdirect. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18libcli/smb: add struct smb_transports infrastructureStefan Metzmacher2-0/+150
This will be able to use a structure instead of a string array with int string values for 'smb ports'. We'll soon add support for smb over quic, so we need something better than tcp ports with 139 being special. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-17libcli/smb: make smb2_lease_{pull,push} endian safeStefan Metzmacher1-4/+8
smbd_smb2_send_lease_break() is already endian safe, which means we'll get a mismatch on big endian systems, so that smbd_smb2_send_lease_break() sends the lease key in reversed order. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Apr 17 11:30:58 UTC 2025 on atb-devel-224
2025-04-17libcli/smb: convert smb2_lease_push() to PUSH_LE_U*Stefan Metzmacher1-5/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org>
2025-04-17libcli/smb: make the last 2 reserved bytes explicit in smb2_lease_push()Stefan Metzmacher1-1/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org>
2025-04-17libcli/smb: convert smb2_lease_pull() to PULL_LE_U*Stefan Metzmacher1-4/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15849 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Björn Jacke <bjacke@samba.org>
2025-03-27libcli: Fix whitespaceVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-03-05libsmb: Save lines with a direct variable initializationVolker Lendecke1-7/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-03-05libsmb: Simplify smbXcli_req_unset_pending()Volker Lendecke1-6/+1
We have ARRAY_DEL_ELEMENT() for this Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-03-05smbclient3: Replacing Echos in the cli status check with TCP status check.Felix Bussmann1-0/+7
Replacing the echoes, which were being sent every 5 seconds by the client for a CLI status check, with a method that checks the status of the file descriptor instead, for a POLLHUP, POLLRDHUP, or a timeout. Signed-off-by: Felix Bussmann <feb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Anoop C S <anoopcs@samba.org> Autobuild-Date(master): Wed Mar 5 16:21:34 UTC 2025 on atb-devel-224
2025-02-05libsmb: Save some bytes in .text codeVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-29libcli:smb: Implement smb2cli_notify_set_notify_async()Andreas Schneider2-1/+30
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14430 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org>
2025-01-29libcli:smb: Implement smb2cli_read_cancel()Andreas Schneider1-0/+13
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14430 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-01-29libcli:smb: Implement smb2cli_read_set_notify_async()Stefan Metzmacher2-0/+32
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14430 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-11-27smbd: rename SMB2_FILE_POSIX_INFORMATION to FSCC_FILE_POSIX_INFORMATIONRalph Boehme1-1/+1
Streamline the info-level defines. Also get rid of SMB2_FILE_POSIX_INFORMATION_INTERNAL which is not needed for an info-level that is exclusive to SMB2. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-19libsmb: Save some .data bytes with a const arrayVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-05libcli/smb: only copy the parent lease key if ↵Ralph Boehme1-1/+3
SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET is set MS-SMB2 3.3.5.9.11 Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create Context: If the SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET bit is set in the Flags field of the request, Lease.ParentLeaseKey MUST be set to the ParentLeaseKey of the request. Found by MS-SMB2-Prototocol-Testsuite test "Compare_Zero_LeaseFlag_ParentLeaseKey". Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-11-05libcli/smb: only allow SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET in lease_flagRalph Boehme1-0/+1
MS-SMB2 3.3.5.9.11 Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create Context: The server MUST attempt to locate a Lease by performing a lookup in the LeaseTable.LeaseList using the LeaseKey ... If no lease is found, one MUST be allocated with the following values set: ... * Lease.Breaking is set to FALSE. ... Ensures we ignore SMB2_LEASE_FLAG_BREAK_IN_PROGRESS. Found by MS-SMB2-Prototocol-Testsuite "BreakReadLeaseV2TestCaseS0". Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>