summaryrefslogtreecommitdiff
path: root/source3/libsmb
AgeCommit message (Collapse)AuthorFilesLines
2025-09-02libsmb: Slightly clarify format in set/get_secdescVolker Lendecke1-3/+5
We have reserved fields after those 16-bit ones. With little endian those are set to 0 with PUSH_LE32. That is unnecessary here, the fields are already set to 0. This patch is not for efficiency, I just got a bit confused by the subtlety. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02libsmb: Make map_fnum_to_smb2_handle type-safeVolker Lendecke1-2/+4
"struct smb2_hnd" is talloced here, use talloc_get_type_abort() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02libsmb: Make dsgetdcname print flags in one DEBUGVolker Lendecke1-37/+48
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02libsmb: Remove an unnecessary castVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02libsmb: Save a few lines with direct var initializationVolker Lendecke1-7/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-08-22libsmb: Add "smb_encryption_over_quic" to smb311_capabilitiesVolker Lendecke1-2/+4
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-22libcli: Add tls_verify_peer_state to smbXcli_transportVolker Lendecke1-17/+26
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-15pylibsmb: add SMB2_FIND_ID_BOTH_DIRECTORY_INFORalph Boehme1-0/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-08-13libads: change netlogon_pings() behaviour wrt to min_servers parameterRalph Boehme1-1/+1
Currently if a caller passes min_servers=X with X>1, netlogon_pings() will fail if it can't contact X DCs. This is not really what we want. What we want is: we want at least one DC, and up to X. Change implemenentation in that sense and rename the min_servers argument to wanted_servers to express this behaviour change. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15844 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Wed Aug 13 19:31:10 UTC 2025 on atb-devel-224
2025-07-30s3/libsmb: check the negative-conn-cache in resolve_ads()Ralph Boehme1-5/+20
This way we throw away blacklisted servers right away when learning about them from the DNS SRV query. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14981 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Wed Jul 30 10:10:21 UTC 2025 on atb-devel-224
2025-07-30s3/libsmb: check command in make_dc_info_from_cldap_reply()Ralph Boehme1-0/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14981 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-07-30s3:conncache: improve debugging for the negative connection cacheStefan Metzmacher1-3/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14981 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-07-22libcli/smb2: dump encryption key in format for Wireshark ↵Ralph Boehme1-1/+7
~/.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 Boehme1-0/+1
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 Boehme1-3/+25
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 Boehme1-53/+3
More callers to come... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-07-17s3:libsmb: add support for userspace quic support using ngtcp2Stefan Metzmacher3-2/+252
By default we fallback to ngtcp2 if the kernel has no quic.ko support. To force it the following option can be used: client smb transport:force_ngtcp2_quic=yes To disable it the following option can be used: client smb transport:allow_ngtcp2_quic=no From within libsmbclient.so we can't use it at all as there's no way monitor the connection in order to handle acked and keep alive pings. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-07-17s3:libsmb: add support for SMB_TRANSPORT_TYPE_QUICStefan Metzmacher1-1/+198
This requires https://github.com/lxin/quic, which provides a kernel module quic.ko for Linux (tested with Linux 6.8 and 6.14). The userspace libquic is mirrored under third_party/quic for now. This can be activated by adding 'quic' to 'client smb transports'. The following smb.conf options are also relevant: 'tls enabled' 'tls ca directories' 'tls trust system cas' 'tls cafile' 'tls crlfile' 'tls verify peer' Note that tools like smbclient are able to take --option='client smb transports = quic" --option='tls verify peer=no_check' in order to test it without changing smb.conf, You may not want to use 'tls verify peer=no_check' for production, it would make the transport as unprotected as a tcp connection. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-07-17libcli/smb: define SMB_TRANSPORT_TYPE_QUICStefan Metzmacher1-0/+13
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-07-07libsmb: use parse_finfo_posix_info in is_bad_finfo_name()Ralph Boehme1-1/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15862 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-07-07libsmb: set finfo->flags.posix in parse_finfo_posix_info()Ralph Boehme1-0/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15862 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-06-20libsmb: Slightly simplify cli_tcon_andx_done()Volker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-20libsmb: Move cli_smb() to source3/tortureVolker Lendecke2-44/+0
Only used there Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-20libsmb: Move cli_smbwrite() to source3/tortureVolker Lendecke2-70/+0
Only used there Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-18s3:libsmb: add 'client smb transport:force_bsd_tstream = yes' optionStefan Metzmacher1-6/+23
This can be used to force the tstream based code path in smbXcli_conn. 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 Metzmacher1-4/+2
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-18s3:libsmb: let smbsock_connect_recv() return smbXcli_transportStefan Metzmacher2-55/+36
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18s3:libsmb: let smbsock_connect() return smbXcli_transportStefan Metzmacher2-4/+24
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18s3:libsmb: let smbsock_any_connect_recv return smbXcli_transportStefan Metzmacher3-46/+25
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18s3:libsmb: let smbsock_any_connect() return smbXcli_transportStefan Metzmacher2-6/+27
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18s3:libsmb: let cli_connect_sock_recv() return smbXcli_transportStefan Metzmacher1-17/+16
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18s3:libsmb: pass smbXcli_transport to cli_state_create()Stefan Metzmacher3-14/+14
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 Metzmacher1-1/+10
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-16libsmbclient: Intercept "smb311_posix.statinfo" attributeVolker Lendecke1-0/+65
Directly get a "struct stat" plus a 32-bit uint32 for the dosatts 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): Mon Jun 16 16:08:20 UTC 2025 on atb-devel-224
2025-06-16libsmbclient: Intercept "posix.attr.enabled" for fgetxattrVolker Lendecke1-0/+27
Local call to find out whether the file was opened with smb311 posix extensions. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-06-16libsmbclient: Request posix file handles on demandVolker Lendecke1-0/+14
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-06-16libsmbclient: Allow O_PATH for smbc_open()Volker Lendecke1-2/+38
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-06-16libsmbclient: Add fgetxattrVolker Lendecke5-1/+240
Just boilerplate so far Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-06-16libsmb: Remove "source3/libsmb/libsmb.h"Volker Lendecke30-60/+59
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-05-19s3:pylibsmb: don't use an unbound talloc_stackframe() in libsmb_samba_cwrapper()Stefan Metzmacher1-2/+0
Code should use there own explicit stackframes. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-05-19s3:pylibsmb: add explicit talloc_stackframes to most functionsStefan Metzmacher1-65/+288
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-05-19s3:pylibsmb: fix a few (potential) memory leaksStefan Metzmacher1-1/+11
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-05-19s3:pylibsmb: avoid using PyErr_NTSTATUS_NOT_OK_RAISE()Stefan Metzmacher1-12/+48
Doing explicit if statements will allow us to do memory cleanup on error. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-05-15libsmb: Modernize two DEBUGsVolker Lendecke1-4/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu May 15 15:06:36 UTC 2025 on atb-devel-224
2025-05-15libsmb: Put useccache initialization into one placeVolker Lendecke1-4/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15libsmb: Avoid an "else"Volker Lendecke1-1/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15libsmb: Avoid a "else" in cli_read_max_bufsize()Volker Lendecke1-1/+3
Simpler to read for me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15libsmb: Remove an unused variableVolker Lendecke1-3/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15libsmb: Reduce indentation in SMBC_attr_server()Volker Lendecke1-94/+95
Use an early return Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-05-15libsmb: Reduce indentation in SMBC_find_server()Volker Lendecke1-25/+24
Use an early return Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>