summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
AgeCommit message (Collapse)AuthorFilesLines
2026-01-07lib: Fix some whitespaceVolker Lendecke1-6/+6
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-07-22libcli/smb2: dump encryption key in format for Wireshark ↵Ralph Boehme1-4/+5
~/.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-22s4/libcli/smb2: dump encryption keys if enabledRalph Boehme1-0/+37
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-07-22s4/libcli/smb2: pass lp_ctx to smb2_session_init() and remember debug ↵Ralph Boehme3-1/+15
encryption settings Not yet used, that comes next. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-06-18s4:libcli: let struct smbcli_socket hold struct smbXcli_transport instead of ↵Stefan Metzmacher1-13/+2
sockfd 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-4/+14
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: pass struct loadparm_context to smbcli_sock_connect_send()Stefan Metzmacher1-1/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: pass struct loadparm_context to smb2_connect_send()Stefan Metzmacher1-0/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: pass struct loadparm_context to smb2_connect_ext()Stefan Metzmacher1-1/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: pass struct loadparm_context to smb2_connect()Stefan Metzmacher1-0/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: simplify struct smbcli_socketStefan Metzmacher1-5/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: remove unused ports from smb2_connect()Stefan Metzmacher1-1/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: remove unused ports argument from smb2_connect_ext()Stefan Metzmacher1-2/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: remove unused ports argument from smb2_connect_sendStefan Metzmacher1-9/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-04-18s4:libcli: pass struct smbcli_options to smbcli_sock_connect() instead of ↵Stefan Metzmacher1-1/+1
port strings This allows us to build the ports array from options.transports. Pair-Programmed-With: Ralph Boehme <slow@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-01-29s4:libcli/smb2: add smb2_tree_channel() helperStefan Metzmacher1-0/+25
This can be used after smb2_session_channel() in order to have a smb2_tree structure representing the same logic tree connect but uses a different channel/connection. 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-08-29s4:libcli/smb2: let smb2_deltree delete directory streamsStefan Metzmacher1-1/+45
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15656 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-08-28smb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responsesDavid Disseldorp1-1/+2
As per MS-FSA 2.1.5.10.22 FSCTL_QUERY_ALLOCATED_RANGES, if response range entries exceed in_max_output, then we should respond with STATUS_BUFFER_OVERFLOW and a truncated output buffer. Bug: https://bugzilla.samba.org/show_bug.cgi?id=15699 Reported-by: David Howells <dhowells@redhat.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Wed Aug 28 08:54:11 UTC 2024 on atb-devel-224
2024-05-23s4:libcli/smb2: add hack to test anonymous signing and encryptionStefan Metzmacher2-5/+13
This will be used in torture tests. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15412 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2024-03-12lib: Make GUID_to_ndr_buf() return voidVolker Lendecke1-15/+3
The whole point of struct GUID_ndr_buf is that this never fails. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30s4:libcli: Call correct function to get HMAC output lengthJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30s4:libcli: Remove trailing whitespaceJoseph Sutton1-8/+8
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-14s4:libcli: Fix code spellingAndreas Schneider3-4/+4
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08s4:torture/smb2: make it possible to pass existing_conn to smb2_connect_ext()Stefan Metzmacher1-1/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15346 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-08-26smbXcli: Pass negotiate contexts through smbXcli_negprot_send/recvVolker Lendecke1-2/+3
We already don't allow setting max_credits in the sync wrapper, so omit the contexts there as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Aug 26 19:54:03 UTC 2022 on sn-devel-184
2022-08-23s4/libcli/smb2: avoid using smb2_composite_setpathinfo() in smb2_util_setatr()Ralph Boehme1-7/+30
smb2_composite_setpathinfo() uses SEC_FLAG_MAXIMUM_ALLOWED which can have unwanted side effects like breaking oplocks if the effective access includes [READ|WRITE]_DATA. For changing the DOS attributes we only need SEC_FILE_WRITE_ATTRIBUTE. With this change test_smb2_oplock_batch25() doesn't trigger an oplock break anymore. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15153 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-06-09lib/util: Change function to mem_equal_const_time()Joseph Sutton1-1/+1
Since memcmp_const_time() doesn't act as an exact replacement for memcmp(), and its return value is only ever compared with zero, simplify it and emphasize the intention of checking equality by returning a bool instead. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-03-17libcli/smb: pass smb3_capabilities to smbXcli_conn_create()Stefan Metzmacher1-1/+2
Passing NULL means use none. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14512 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-10-02libcli: Use GUID_to_ndr_buf() in smb2_create_send()Volker Lendecke1-13/+9
Avoid talloc/free Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-08-19s4:libcli: Require signing for SMB encryptionAndreas Schneider1-1/+8
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2020-08-19s4:libcli: Add smb2_connect_enc_start()Andreas Schneider1-0/+38
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2020-08-19s3:libcli: Split out smb2_connect_tcon_start()Andreas Schneider1-1/+12
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2020-07-08s4:libcli/smb2: add const to struct smbcli_options *options for smb2_connect()Stefan Metzmacher1-1/+1
It will just be passed to smb2_connect_ext(), which already takes a const pointer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2020-07-08s4:libcli/smb2: allow smb2_connect*() to fake session and tconStefan Metzmacher1-0/+9
For multichannel connection we want a way to have just a connection with a negprot finished. For now we just fake a tcon and session in order to avoid changes in the caller. We can clean that up later if needed. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2020-06-22source4/libcli: Use NT_STATUS_PENDING instead of STATUS_PENDINGChristof Schmitt1-1/+1
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2020-04-28Implement alt name query for smb2David Mulder1-0/+53
Implements smb2_qpathinfo_alt_name() and RAW_FILEINFO_SMB2_ALT_NAME_INFORMATION. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 097df343ce21c8340aee7f42f233fe74b92b47e2)
2020-04-28Add SMB2 lsa helper routinesDavid Mulder1-0/+11
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 3763052c2a95ac9bd60f00458389a5245cf5d58d)
2019-12-20Convert samba4.base.*attr tests to smb2David Mulder1-0/+46
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-09-25s4/libcli/smb2: clang: Fix 'value stored to 'status' is never read'Noel Power1-3/+3
Fixes: source4/libcli/smb2/util.c:134:3: warning: Value stored to 'status' is never read <--[clang] status = smb2_util_setatr(tree, dname, FILE_ATTRIBUTE_NORMAL); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source4/libcli/smb2/util.c:187:5: warning: Value stored to 'status' is never read <--[clang] status = smb2_util_setatr(tree, name, FILE_ATTRIBUTE_NORMAL); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source4/libcli/smb2/util.c:209:3: warning: Value stored to 'status' is never read <--[clang] status = smb2_util_setatr(tree, dname, FILE_ATTRIBUTE_NORMAL); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 warnings generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-09-25s4/libcli/smb2: clang: Fix Passed-by-value arg contains uninitialized dataNoel Power1-1/+3
Fixes: source4/libcli/smb2/getinfo.c:222:11: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'data') <--[clang] status = smb_raw_fsinfo_passthru_parse(b.out.blob, mem_ctx, io->generic.level, io); ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-27lib/crypto: move gnutls error wrapper to own subsystemAndrew Bartlett2-2/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-24s4:libcli: Use gnutls_error_to_ntstatus() or singingAndreas Schneider1-2/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-04-30s4:libcli:smb2: Use GnuTLS SHA256 HMAC for signingAndreas Schneider1-17/+32
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-04-01libsmb: Rename InfoType from [MS-SMB2] according to the specVolker Lendecke2-5/+8
This makes it easier to find this via internet search Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-28s4:libcli/smb2: calculate the correct credit charge in smb2_notify_send()Stefan Metzmacher1-0/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-28s4:libcli/smb2: calculate the correct credit charge in smb2_ioctl_send()Stefan Metzmacher1-0/+11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-28s4:libcli/smb2: align struct smb_ioctl.smb2 to [MS-SMB2] namesStefan Metzmacher1-5/+5
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-28s4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()Stefan Metzmacher1-0/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-28s4:libcli/smb2: fix smb2_getinfo_send() marshallingStefan Metzmacher2-9/+20
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-28s4:libcli/smb2: don't schedule idle handlers on a dead connectionStefan Metzmacher1-0/+17
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>