summaryrefslogtreecommitdiff
path: root/libcli/smb
Commit message (Collapse)AuthorAgeFilesLines
* libcli/smb: define FSCTL_SMBTORTURE_FORCE_UNACKED_TIMEOUTStefan Metzmacher2020-07-081-0/+8
| | | | | | | | | | This will be used by smbtorture in order to simulate channel failures without relying on iptables. 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>
* libcli: Use NT_STATUS_PENDING instead of STATUS_PENDINGChristof Schmitt2020-06-221-3/+3
| | | | Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcli: Add tevent_req_received() calls to smb2cli_create_recv()Volker Lendecke2020-06-151-0/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libcli: Move IO_REPARSE_TAG definitions to smb_constants.hVolker Lendecke2020-06-151-0/+16
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libcli: Slightly simplify smb2cli_req_recv() with an early returnVolker Lendecke2020-06-151-6/+1
| | | | | | | One if-condition less Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* add some missing FSCTL definesBjörn Jacke2020-05-191-0/+8
| | | | | | | | | | | | | | | | | | | | as dodumented in https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/a64e55aa-1152-48e4-8206-edd96444e7f7 FSCTL_SET_OBJECT_ID_EXTENDED FSCTL_READ_FILE_USN_DATA FSCTL_WRITE_USN_CLOSE_RECORD FSCTL_QUERY_ON_DISK_VOLUME_INFO FSCTL_QUERY_SPARING_INFO FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX FSCTL_STORAGE_QOS_CONTROL Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Björn Jacke <bjacke@samba.org> Autobuild-Date(master): Tue May 19 15:57:08 UTC 2020 on sn-devel-184
* libsmb: Make sure that the TCP socket is non-blockingVolker Lendecke2020-03-251-0/+1
| | | | | | | | | | All traffic goes through smbXcli_base.c, and that is prepared to deal with short writes via the conn->outgoing queue. Instead of making sure that all callers properly set the socket nonblocking, do it here, so that we can later optimize sending out data to the server. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* libcli: Align integer typesVolker Lendecke2020-03-101-1/+1
| | | | | | | | 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): Tue Mar 10 23:08:20 UTC 2020 on sn-devel-184
* smbd: Add make_smb2_posix_create_ctx()Volker Lendecke2020-02-073-0/+89
| | | | | | | | Will be used internally to pass an artificial posix create context into VFS_CREATE_FILE from the SMB1 unix extension calls Pair programmed with: Jeremy Allison <jra@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org>
* libsmb: Add smb2_create_blob_remove()Volker Lendecke2020-02-072-0/+17
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libsmb: Allow passing in NULL to smb2_create_blob_find()Volker Lendecke2020-02-071-0/+4
| | | | | | | | Will simplify callers a bit, and it does not change semantics significantly. Zero create blobs won't find anything anyway. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libsmb: Add posix create context definitionVolker Lendecke2020-02-071-0/+1
| | | | | Pair programmed with: Jeremy Allison <jra@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org>
* libsmb: Add required #includes to smb_util.hVolker Lendecke2020-02-071-0/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libsmb: Add required includes to smb2_create_blob.hVolker Lendecke2020-02-071-0/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libsmb: Remove "const" from smb_create_blob->tagVolker Lendecke2020-02-071-1/+1
| | | | | | | I want to TALLOC_FREE that soon, and we do a talloc_strdup into this anyway. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libcli:smb: Don't use forward declartions for GnuTLS typedefsStefan Metzmacher2020-02-072-9/+15
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14271 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Feb 7 13:48:27 UTC 2020 on sn-devel-184
* libcli:smb: Improve check for gnutls_aead_cipher_(en|de)cryptv2Andreas Schneider2020-02-041-5/+2
| | | | | | | | | | | | | | | This is available since version 3.6.10, but 3.6.10 has a bug which got fixed in 3.6.11, see: https://gitlab.com/gnutls/gnutls/-/merge_requests/1085 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14250 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Feb 4 06:44:00 UTC 2020 on sn-devel-184
* libsmb: Fix a typoVolker Lendecke2020-01-301-1/+1
| | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* build: Do not build selftest binaries for builds without --enable-selftestAndrew Bartlett2019-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new for_selftest option to SAMBA_BINARY() and SAMBA3_BINARY() This allows us to be much more consistent (at least in the core Samba) and documents clearly why the binary should not be installed. Not modified are - test_lp_load - notifyd-tests - gendrandperf - test* from examples/libsmbclient - dbwrap_torture - split_tokens - locktest2 - msgtest - msg_sink - msg_source - versiontest - rpc_open_tcp - test_headers As these are not tested in selftest so any change would also be untested. Of course they probably should be added in a different MR. Also not modified (because they are not tests, nor part of the build system) are: - smb2mount - notifydd - log2pacp - debug2html - smbfilter - destroy_netlogon_creds_cli - spotlight2* - tevent_glib_tracker These do however appear to be untested. For now, the source4 forked client tools are left unchanged: - smbclient4 - nmblookup4 Finally, the heimdal binaries are left as install=False as they are either part of the build system or end-user tools that we just don't want to install. These are however tested. The motivation is commit like c34ec003b7d45aa4196ff93a0ac29694b25e5309 and da87fa998ab71328f30bcdf5b41aee8675aee48a, which are both totally correct but are not needed if the selftest is not run on MacOS. There are likely other platforms or build environments where building our test binaries is more pain than valuable, see for example also https://lists.samba.org/archive/samba/2019-November/227137.html Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org> Autobuild-User(master): Isaac Boukris <iboukris@samba.org> Autobuild-Date(master): Fri Nov 22 11:48:59 UTC 2019 on sn-devel-184
* libcli:smb: Do not use gnutls_aead_cipher_encryptv2() with GnuTLS 3.6.10Andreas Schneider2019-11-041-2/+6
| | | | | | | | | | The gnutls_aead_cipher_encryptv2() implementation was released with a bug. This wont be fixed before 3.6.11. See https://gitlab.com/gnutls/gnutls/merge_requests/1085 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* libcli smb smb1cli_trans: fix ubsan warningGary Lockyer2019-10-161-2/+4
| | | | | | | | | | | | Fix ubsan warning null pointer passed as argument 2 when the source pointer is NULL. The calls to memcpy are now guarded by an if (len > 0) Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Oct 16 18:00:31 UTC 2019 on sn-devel-184
* libcli:smb: Use gnutls_aead_cipher_decryptv2() for AES GCM or CCMAndreas Schneider2019-10-081-2/+27
| | | | | | | | | | | This is a new call which has been added with GnuTLS 3.6.10 and will recuduce memory allocations and copying of data. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Simo Sorce <idra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Oct 8 14:12:44 UTC 2019 on sn-devel-184
* libcli:smb: Use gnutls_aead_cipher_encryptv2() for AES GCM or CCMAndreas Schneider2019-10-081-2/+30
| | | | | | | | This is a new call which has been added with GnuTLS 3.6.10 and will recuduce memory allocations and copying of data. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* libcli:smb: Prefer AES-GCM over AES-CCM with GnuTLSAndreas Schneider2019-08-271-6/+3
| | | | | | | | | | | The AES-GCM implementation in GnuTLS is faster. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adapted to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_encrypt_pdu()Andreas Schneider2019-08-271-3/+2
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use smb2_signing_key in smb2_signing_encrypt_pdu()Andreas Schneider2019-08-273-22/+18
| | | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adaped to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_decrypt_pdu()Andreas Schneider2019-08-271-3/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use smb2_signing_key in smb2_signing_decrypt_pdu()Andreas Schneider2019-08-273-21/+17
| | | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adaped to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Support GnuTLS AES CCM and GCM in smb2_signing_decrypt_pdu()Andreas Schneider2019-08-271-45/+125
| | | | | | | | | | | This requires GnuTLS >= 3.4.0. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adapted to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Support GnuTLS AES CCM and GCM in smb2_signing_encrypt_pdu()Andreas Schneider2019-08-271-45/+124
| | | | | | | | | | | This requires GnuTLS >= 3.4.0. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adapted to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli/smb: Use gnutls_error_to_ntstatus() in smb2_signing_check_pdu()Andrew Bartlett2019-08-211-4/+4
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* libcli:smb: Use GnuTLS AES128 CMAC in smb2_signing_check_pdu()Andreas Schneider2019-08-211-0/+38
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli/smb: Use gnutls_error_to_ntstatus() in smb2_signing_sign_pdu()Andrew Bartlett2019-08-211-2/+2
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* libcli:smb: Use GnuTLS AES128 CMAC in smb2_signing_sign_pdu()Andreas Schneider2019-08-211-0/+33
| | | | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adapted by Andrew Bartlett to followup from earlier patch to allow compile without GnuTLS over the whole series. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use a smb2_signing_key for storing the decryption keyAndreas Schneider2019-08-211-7/+16
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use a smb2_signing_key for storing the encryption keyAndreas Schneider2019-08-211-10/+19
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Add gnutls_aead_cipher_hd_t to smb2_signing_key structureAndreas Schneider2019-08-212-0/+8
| | | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adapted to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use GnuTLS for AES constantsAndreas Schneider2019-08-211-5/+2
| | | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adapted to remove Samba AES support Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Define SMB2_AES_128_CCM_NONCE_SIZEAndreas Schneider2019-08-211-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Use generate_nonce_buffer() for AES-CCM and AES-GCM nonceAndreas Schneider2019-08-121-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli:smb: Add forward declaration for gnutls_hmac_hd_tAndreas Schneider2019-08-101-3/+3
| | | | | | | | | This file is basically included everywhere. So use a forward declaration for gnutls_hmac_hd_t. This way we don't have to link everthing against gnutls to get access to the header path. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libcli/smb: send SMB2_NETNAME_NEGOTIATE_CONTEXT_IDStefan Metzmacher2019-08-011-0/+17
| | | | | | | | | | | | | | Note: Unlike the current documentation, the utf16 string is not null-terminated, that matches Windows Server 1903 as a client. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055 RN: Add the target server name of SMB 3.1.1 connections as a hint to load balancers or servers with "multi-tenancy" support. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
* libcli/smb: add new COMPRESSION and NETNAME negotiate context idsStefan Metzmacher2019-08-011-0/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14055 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
* libcli/smb: clang: Fix Value stored to 'next_offset' is never readNoel Power2019-07-241-1/+0
| | | | | | | | | | | | Fixes: ibcli/smb/smb2_negotiate_context.c:117:3: warning: Value stored to 'next_offset' is never read <--[clang] next_offset += next_pad; ^ ~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcli/smb: clang: Fix ' 2nd function call argument is an uninitialized value'Noel Power2019-07-161-1/+1
| | | | | | | | | | Fixes: /home/samba/samba/libcli/smb/smbXcli_base.c:5120:8: warning: 2nd function call argument is an uninitialized value <--[clang] rc = gnutls_hash(hash_hnd, Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcli/smb: clang: Fix 'Dereference of null pointer'Noel Power2019-07-161-2/+2
| | | | | | | | | | | Fixes: smbXcli_base.c:4885:20: warning: Dereference of null pointer <--[clang] body = (uint8_t *)iov[1].iov_base; ^~~~~~~~~~~~~~~ Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcli/smb: clang: Fix 'Array access results in a null pointer deref'Noel Power2019-07-161-2/+2
| | | | | | | | | | Fixes: smbXcli_base.c:4393:10: warning: Array access (from variable 'inhdr') results in a null pointer dereference <--[clang] flags = CVAL(inhdr, HDR_FLG); Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcli/smb: clang: Fix 'array access results in a null pointer deref'Noel Power2019-07-161-1/+2
| | | | | | | | | | | Fixes: smbXcli_base.c:1239:9: warning: Array access (via field 'pending') results in a null pointer dereference <--[clang] req = conn->pending[0]; ^ Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcl/smb: clang: Fix 'Value stored to 'next_offset' is never read'Noel Power2019-07-111-1/+0
| | | | | | | | | | | | Fixes: libcli/smb/smb2_create_blob.c:146:3: warning: Value stored to 'next_offset' is never read <--[clang] next_offset += next_pad; ^ ~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* libcli/smb: clang: Fix 'value stored to 'p' is never read'Noel Power2019-07-111-2/+0
| | | | | | | | | | | | | Fixes: libcli/smb/smb1cli_session.c:226:2: warning: Value stored to 'p' is never read <--[clang] p += ret; ^ ~~~ libcli/smb/smb1cli_session.c:517:2: warning: Value stored to 'p' is never read <--[clang] p += ret; ^ ~~~ Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>