]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
13 months agos4: s/the the\b/the/ in miscellaneous comments
Douglas Bagnall [Fri, 13 Sep 2024 02:30:42 +0000 (14:30 +1200)] 
s4: s/the the\b/the/ in miscellaneous comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agos4:ldb_mods:group_audit: s/the the/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:28:52 +0000 (14:28 +1200)] 
s4:ldb_mods:group_audit: s/the the/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agos3:smbd:posix_acls: s/the the/that the/ in comment
Douglas Bagnall [Fri, 13 Sep 2024 02:27:57 +0000 (14:27 +1200)] 
s3:smbd:posix_acls: s/the the/that the/ in comment

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agos3:printing and spoolss: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:27:05 +0000 (14:27 +1200)] 
s3:printing and spoolss: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agos3:headers: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:26:35 +0000 (14:26 +1200)] 
s3:headers: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agos3:client:clitar: s/the the/to the/ in comment
Douglas Bagnall [Fri, 13 Sep 2024 02:25:36 +0000 (14:25 +1200)] 
s3:client:clitar: s/the the/to the/ in comment

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agopytest: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:24:55 +0000 (14:24 +1200)] 
pytest: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agosamba-tool:: s/the the\b/the/ in docstring
Douglas Bagnall [Fri, 13 Sep 2024 02:24:20 +0000 (14:24 +1200)] 
samba-tool:: s/the the\b/the/ in docstring

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agonsswitch:: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:23:47 +0000 (14:23 +1200)] 
nsswitch:: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agolibcli:auth:msrpc_parse: s/the the/is the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:22:30 +0000 (14:22 +1200)] 
libcli:auth:msrpc_parse: s/the the/is the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agoutil:charset: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:21:33 +0000 (14:21 +1200)] 
util:charset: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agotevent docs: s/the the\b/the/
Douglas Bagnall [Fri, 13 Sep 2024 02:21:12 +0000 (14:21 +1200)] 
tevent docs: s/the the\b/the/

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agopyldb: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:19:41 +0000 (14:19 +1200)] 
pyldb: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agoldb:pack: s/the the/in the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:19:23 +0000 (14:19 +1200)] 
ldb:pack: s/the the/in the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agolib/afs: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:18:00 +0000 (14:18 +1200)] 
lib/afs: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agoctdb:tests: s/the the\b/the/ in comments
Douglas Bagnall [Fri, 13 Sep 2024 02:17:30 +0000 (14:17 +1200)] 
ctdb:tests: s/the the\b/the/ in comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agoWHATSNEW: SMB3 Directory Leases
Ralph Boehme [Thu, 24 Oct 2024 19:32:49 +0000 (21:32 +0200)] 
WHATSNEW: SMB3 Directory Leases

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Nov  5 15:51:27 UTC 2024 on atb-devel-224

13 months agosmbtorture: Directory Leases vs unlink
Ralph Boehme [Wed, 23 Oct 2024 18:11:59 +0000 (20:11 +0200)] 
smbtorture: Directory Leases vs unlink

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs hardlink
Ralph Boehme [Mon, 21 Oct 2024 10:33:08 +0000 (12:33 +0200)] 
smbtorture: Directory Leases vs hardlink

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs overwrite
Ralph Boehme [Fri, 18 Oct 2024 16:29:09 +0000 (18:29 +0200)] 
smbtorture: Directory Leases vs overwrite

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs renaming
Ralph Boehme [Mon, 9 Sep 2024 14:03:59 +0000 (16:03 +0200)] 
smbtorture: Directory Leases vs renaming

Note that we must use defines for the DLEASE* values, as declaring them as const
int triggers a CI failure on one of the runners (opensuse155-samba-o3) likely
due to a bug in its gcc version:

  ../../source4/torture/smb2/lease.c:6242:22: error: initializer element is not constant
     .srcdir_leasekey = DLEASE1,
                        ^~~~~~~

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs setting access date
Ralph Boehme [Mon, 9 Sep 2024 09:19:32 +0000 (11:19 +0200)] 
smbtorture: Directory Leases vs setting access date

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs setting inode change date
Ralph Boehme [Mon, 9 Sep 2024 08:37:19 +0000 (10:37 +0200)] 
smbtorture: Directory Leases vs setting inode change date

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs setting modification date
Ralph Boehme [Mon, 9 Sep 2024 08:35:09 +0000 (10:35 +0200)] 
smbtorture: Directory Leases vs setting modification date

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs setting creation date
Ralph Boehme [Fri, 18 Oct 2024 10:56:31 +0000 (12:56 +0200)] 
smbtorture: Directory Leases vs setting creation date

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs setting DOS attributes
Ralph Boehme [Fri, 18 Oct 2024 10:55:42 +0000 (12:55 +0200)] 
smbtorture: Directory Leases vs setting DOS attributes

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: Directory Leases vs setting EOF
Ralph Boehme [Fri, 18 Oct 2024 11:02:45 +0000 (13:02 +0200)] 
smbtorture: Directory Leases vs setting EOF

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibcli/smb: only copy the parent lease key if SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET...
Ralph Boehme [Thu, 24 Oct 2024 17:35:00 +0000 (19:35 +0200)] 
libcli/smb: only copy the parent lease key if 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>
13 months agosmbtorture: check parent leasekey is ignored unless SMB2_LEASE_FLAG_PARENT_LEASE_KEY_...
Ralph Boehme [Thu, 24 Oct 2024 10:00:40 +0000 (12:00 +0200)] 
smbtorture: check parent leasekey is ignored unless SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET is set

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibcli/smb: only allow SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET in lease_flag
Ralph Boehme [Tue, 22 Oct 2024 13:05:58 +0000 (15:05 +0200)] 
libcli/smb: only allow SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET in lease_flag

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>
13 months agosmbtorture: check SMB2_LEASE_FLAG_BREAK_IN_PROGRESS when client requests new lease
Ralph Boehme [Thu, 24 Oct 2024 09:52:19 +0000 (11:52 +0200)] 
smbtorture: check SMB2_LEASE_FLAG_BREAK_IN_PROGRESS when client requests new lease

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: expand Directory Leases test "v2_request
Ralph Boehme [Fri, 18 Oct 2024 15:25:56 +0000 (17:25 +0200)] 
smbtorture: expand Directory Leases test "v2_request

Add three subtests:

- trigger a sharing violation, ack break, create fails with STATUS_SHARING_VIOLATION
- trigger a sharing violation, close conflicting open, create succeeds
- write with valid parent lease key.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: simplify test_lease_v2_request()
Ralph Boehme [Fri, 6 Sep 2024 16:07:35 +0000 (18:07 +0200)] 
smbtorture: simplify test_lease_v2_request()

- Add and use test_rearm_dirlease().
- Rename variable "ls2" to "dirlease".
- Simplify lease epoch tracking by using dirlease.lease_epoch as a counter.
- Add comments.
- Zero out a handle after closing it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: add test smb2.dirleases.leases
Ralph Boehme [Fri, 18 Oct 2024 15:19:34 +0000 (17:19 +0200)] 
smbtorture: add test smb2.dirleases.leases

Checks server accepts "RWH", "RH" and "R" lease request and grants at most
(lease_request & "RH"), so no "W", but "R" without "H" if requested.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos4/torture: give smb2_generic_create_share() caller some flexibility
Ralph Boehme [Sun, 27 Feb 2022 17:48:49 +0000 (18:48 +0100)] 
s4/torture: give smb2_generic_create_share() caller some flexibility

This way callers can either create or open a directory.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: add "smb2.dirlease" test suite
Ralph Boehme [Fri, 18 Oct 2024 12:51:09 +0000 (14:51 +0200)] 
selftest: add "smb2.dirlease" test suite

Move all existing Directory Leases tests to this test suite and require
SMB2_CAP_DIRECTORY_LEASING.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: grant Directory Lease if requested
Ralph Boehme [Tue, 3 Sep 2024 20:08:11 +0000 (22:08 +0200)] 
smbd: grant Directory Lease if requested

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add option "smb3 directory leases"
Ralph Boehme [Wed, 12 May 2021 09:24:45 +0000 (11:24 +0200)] 
smbd: add option "smb3 directory leases"

By default enabled on non-clustered Samba, disabled on clustered Samba, the
reason being the expected additional load caused by forcing strict rename to be
enabled.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agodocs: fix indentation of "strict rename"
Ralph Boehme [Fri, 18 Oct 2024 14:17:08 +0000 (16:17 +0200)] 
docs: fix indentation of "strict rename"

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: allow directory leases in close_directory()
Ralph Boehme [Fri, 6 Sep 2024 10:28:46 +0000 (12:28 +0200)] 
smbd: allow directory leases in close_directory()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: use get_deferred_open_message_state() in open_directory()
Ralph Boehme [Fri, 6 Sep 2024 09:46:12 +0000 (11:46 +0200)] 
smbd: use get_deferred_open_message_state() in open_directory()

"deferred" will be used in the function by a later commit...

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibcli/smb: ignore lease_flags and lease_duration for leasev1 in smb2_lease_pull()
Ralph Boehme [Mon, 21 Oct 2024 10:51:20 +0000 (12:51 +0200)] 
libcli/smb: ignore lease_flags and lease_duration for leasev1 in smb2_lease_pull()

MS-SMB2 2.2.13.2.8 SMB2_CREATE_REQUEST_LEASE:

  LeaseFlags (4 bytes): This field MUST NOT be used and MUST be reserved.
  The client MUST set this to 0, and the server MUST ignore it on receipt.

  LeaseDuration (8 bytes): This field MUST NOT be used and MUST be reserved.
  The client MUST set this to 0, and the server MUST ignore it on receipt.

So let's really, really ignore it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibcli/smb: rely on the caller zero-initializing "lease" in smb2_lease_pull()
Ralph Boehme [Mon, 21 Oct 2024 10:48:19 +0000 (12:48 +0200)] 
libcli/smb: rely on the caller zero-initializing "lease" in smb2_lease_pull()

Doing the zero initialization per struct member just feels like a way for bugs
to creep in, even when leasev1 is not going to change ever. The only caller has
already zero-initialized state->lease twice via 1) __tevent_req_create() and 2)
a struct initializer of "state".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when creating hardlink
Ralph Boehme [Sun, 20 Oct 2024 19:37:41 +0000 (21:37 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when creating hardlink

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger change notification when creating hardlink
Ralph Boehme [Sun, 20 Oct 2024 19:36:59 +0000 (21:36 +0200)] 
smbd: trigger change notification when creating hardlink

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agovfs_tsmsm: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing offline attribute
Ralph Boehme [Wed, 19 May 2021 13:51:36 +0000 (15:51 +0200)] 
vfs_tsmsm: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing offline attribute

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agovfs_gpfs: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing offline attribute
Ralph Boehme [Wed, 19 May 2021 13:51:14 +0000 (15:51 +0200)] 
vfs_gpfs: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing offline attribute

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing timestamps
Ralph Boehme [Sat, 7 Sep 2024 13:52:04 +0000 (15:52 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when changing timestamps

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: in smb_set_file_time() rename "action" variable to "filter"
Ralph Boehme [Thu, 5 Sep 2024 17:00:32 +0000 (19:00 +0200)] 
smbd: in smb_set_file_time() rename "action" variable to "filter"

This matches the notify_fname() argument name and the next commit is going to
add an "action" variable.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when modifying DOS attributes
Ralph Boehme [Thu, 5 Sep 2024 17:29:23 +0000 (19:29 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when modifying DOS attributes

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when setting file EOF
Ralph Boehme [Wed, 19 May 2021 13:45:37 +0000 (15:45 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when setting file EOF

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK for renames
Ralph Boehme [Sat, 7 Sep 2024 14:02:23 +0000 (16:02 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK for renames

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: pass lck down to rename_internals_fsp()
Ralph Boehme [Mon, 30 Sep 2024 18:03:43 +0000 (20:03 +0200)] 
smbd: pass lck down to rename_internals_fsp()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when closing a modified file
Ralph Boehme [Wed, 12 May 2021 17:53:38 +0000 (19:53 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when closing a modified file

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when truncating files
Ralph Boehme [Sat, 19 Oct 2024 05:47:33 +0000 (07:47 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when truncating files

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing directories
Ralph Boehme [Sat, 7 Sep 2024 13:20:14 +0000 (15:20 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing directories

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing files
Ralph Boehme [Sat, 7 Sep 2024 14:21:41 +0000 (16:21 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when removing files

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/locking: return parent_lease_key from get_delete_on_close_token()
Ralph Boehme [Wed, 23 Oct 2024 13:38:01 +0000 (15:38 +0200)] 
s3/locking: return parent_lease_key from get_delete_on_close_token()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/locking: remember parent_lease_key that set delete-on-close
Ralph Boehme [Wed, 23 Oct 2024 12:10:46 +0000 (14:10 +0200)] 
s3/locking: remember parent_lease_key that set delete-on-close

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when creating files and directories
Ralph Boehme [Mon, 9 Sep 2024 19:55:36 +0000 (21:55 +0200)] 
smbd: trigger NOTIFY_ACTION_DIRLEASE_BREAK when creating files and directories

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: use contend_dirleases() in notify_fname()
Ralph Boehme [Wed, 19 May 2021 13:03:48 +0000 (15:03 +0200)] 
smbd: use contend_dirleases() in notify_fname()

Prepares for Directory Lease breaks.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add flag NOTIFY_ACTION_DIRLEASE_BREAK for notify_fname()
Ralph Boehme [Wed, 19 May 2021 12:42:14 +0000 (14:42 +0200)] 
smbd: add flag NOTIFY_ACTION_DIRLEASE_BREAK for notify_fname()

Will be used to trigger Directory Lease breaks from notify_fname().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add contend_dirleases()
Ralph Boehme [Wed, 4 Sep 2024 15:58:45 +0000 (17:58 +0200)] 
smbd: add contend_dirleases()

Checks for Directory Lease breaks on the parent directory of smb_fname. Gets a
sharemode lock on the locking.tdb record of the directory, hence it mustn't be
called if the caller still has another sharmode lock.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: pass lease, if any, to notify_fname()
Ralph Boehme [Mon, 4 Nov 2024 17:48:14 +0000 (18:48 +0100)] 
smbd: pass lease, if any, to notify_fname()

notify_fname() for NOTIFY_ACTION_DIRLEASE_BREAK will soon need the lease of the
current open and to implement "MS-FSA 2.1.4.12 Algorithm to Check for an Oplock
Break" with flags=PARENT_OBJECT.

No change in behaviour for now, all callers pass lease=NULL;

Also change path arg to struct smb_filename.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: pass lease and oplock_request to open_directory()
Ralph Boehme [Tue, 3 Sep 2024 18:24:22 +0000 (20:24 +0200)] 
smbd: pass lease and oplock_request to open_directory()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: pass fsp to notify_rename()
Ralph Boehme [Mon, 21 Oct 2024 13:52:29 +0000 (15:52 +0200)] 
smbd: pass fsp to notify_rename()

Not used for now, that comes soon.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: notify file truncation after dropping the sharemode lock
Ralph Boehme [Mon, 4 Nov 2024 17:44:08 +0000 (18:44 +0100)] 
smbd: notify file truncation after dropping the sharemode lock

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: move notify_fname() out of rmdir_internals() up to close_directory()
Ralph Boehme [Sat, 7 Sep 2024 14:24:01 +0000 (16:24 +0200)] 
smbd: move notify_fname() out of rmdir_internals() up to close_directory()

This way we've already dropped the sharemode lock.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: call notify_rename() after dropping the lck in rename_internals_fsp()
Ralph Boehme [Fri, 6 Sep 2024 10:40:43 +0000 (12:40 +0200)] 
smbd: call notify_rename() after dropping the lck in rename_internals_fsp()

Same here, cf the explanation in the previous commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: trigger notification for file and directory creation will be sent a wee bit...
Ralph Boehme [Mon, 9 Sep 2024 19:27:45 +0000 (21:27 +0200)] 
smbd: trigger notification for file and directory creation will be sent a wee bit later after dropping the sharemode lock

This will be a common pattern in the upcoming code dealing with Directory Lease
breaks: when checking for Directory Lease breaks on the parent directory, we
take the sharemode lock on the parent and hence by then must have dropped the
sharemode lock on the object that performs the Directory Lease break check. That
functionality will be later added to notify_fname().

This means the notification will be sent a wee bit later, but that's something
the change notification protocol has to live with anyway.

For Directory Leases the sequence to check for Directory Lease breaks is to call
MS-FSA 2.1.4.12 "Algorithm to Check for an Oplock Break" with
flags=PARENT_OBJECT at the end of each relevant operation, eg creating a file
asf, when processing of the operation that will call 2.1.4.12 is already
completed.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add fsp_get_smb2_lease()
Ralph Boehme [Wed, 19 May 2021 14:58:21 +0000 (16:58 +0200)] 
smbd: add fsp_get_smb2_lease()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: ndrprint lease value in leases_db_set_fn()
Ralph Boehme [Wed, 12 May 2021 19:31:27 +0000 (21:31 +0200)] 
smbd: ndrprint lease value in leases_db_set_fn()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: check for handle lease break on destination when renaming
Ralph Boehme [Fri, 18 Oct 2024 06:02:21 +0000 (08:02 +0200)] 
smbd: check for handle lease break on destination when renaming

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: Split out smb2_parse_file_rename_information()
Ralph Boehme [Fri, 20 Sep 2024 03:14:12 +0000 (05:14 +0200)] 
smbd: Split out smb2_parse_file_rename_information()

No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: expand test test_lease_v2_rename_target_overwrite()
Ralph Boehme [Mon, 14 Oct 2024 15:20:16 +0000 (17:20 +0200)] 
smbtorture: expand test test_lease_v2_rename_target_overwrite()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: recursive delay_for_handle_lease_break_send()
Ralph Boehme [Thu, 17 Oct 2024 17:18:57 +0000 (19:18 +0200)] 
smbd: recursive delay_for_handle_lease_break_send()

Check for open files recursively when renaming a directory and wait for handle
lease breaks.

As delay_for_handle_lease_break_send() does the same check as
have_file_open_below(), remove have_file_open_below() from can_rename() so it is
not called twice for SMB2 renames, and add calls to have_file_open_below() to the
SMB1 entry rename entry points.

This is a bit ugly, but I don't see any other good way of doing this.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: consolidate "have_file_open_below" logic in have_file_open_below()
Ralph Boehme [Sun, 13 Oct 2024 15:44:18 +0000 (17:44 +0200)] 
smbd: consolidate "have_file_open_below" logic in have_file_open_below()

Let have_file_open_below() be the single function to check if
"have_file_open_below" and let it check internally whether to just search the
fsp list in the process or traversing locking.tdb based on the setting of
"strict rename".

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/locking: pass file_id instead of lck to share_mode_watch_send()
Ralph Boehme [Sun, 13 Oct 2024 09:57:45 +0000 (11:57 +0200)] 
s3/locking: pass file_id instead of lck to share_mode_watch_send()

In the future not all callers will have a share_mode_lock around.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: print lease key using hex format in get_lease_type()
Ralph Boehme [Wed, 2 Oct 2024 05:46:48 +0000 (07:46 +0200)] 
smbd: print lease key using hex format in get_lease_type()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add has_nonposix_opens()
Ralph Boehme [Wed, 16 Oct 2024 05:37:25 +0000 (07:37 +0200)] 
smbd: add has_nonposix_opens()

...reusing has_other_nonposix_opens_fn().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: ignore POSIX opens in file_find_subpath()
Ralph Boehme [Sun, 6 Oct 2024 14:37:47 +0000 (16:37 +0200)] 
smbd: ignore POSIX opens in file_find_subpath()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: ignore POSIX and stale opens in have_file_open_below()
Ralph Boehme [Mon, 30 Sep 2024 14:50:49 +0000 (16:50 +0200)] 
smbd: ignore POSIX and stale opens in have_file_open_below()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add opens_below_forall() and opens_below_forall_read()
Ralph Boehme [Sat, 12 Oct 2024 14:33:47 +0000 (16:33 +0200)] 
smbd: add opens_below_forall() and opens_below_forall_read()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/locking: add share_entry_forall_read() and share_entry_forall() varients
Ralph Boehme [Sun, 13 Oct 2024 09:11:32 +0000 (11:11 +0200)] 
s3/locking: add share_entry_forall_read() and share_entry_forall() varients

All existing callers use share_entry_forall_read, so no change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/locking: tweak share_entry_forall()
Ralph Boehme [Sat, 12 Oct 2024 14:03:56 +0000 (16:03 +0200)] 
s3/locking: tweak share_entry_forall()

Gives the callback function more control about when of a locking.tdb
traverse is stopped. If the callback function returns:

  0 => continue traverse
  1 => stop loop over share_mode_entries, but continue share_mode_data traverse
 -1 => stop whole share_mode_data traverse

All existing callers of share_entry_forall() either return 0 or -1 from their
callback functions, so no change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/locking: add share_mode_forall() and share_mode_forall_read() varients
Ralph Boehme [Sat, 12 Oct 2024 15:32:01 +0000 (17:32 +0200)] 
s3/locking: add share_mode_forall() and share_mode_forall_read() varients

All existing callers use share_mode_forall_read(), so no change in behaviour.

Note: doing the indirection via the function pointers "ro_fn" and "rw_fn" in a
single state "struct share_mode_forall_state" avoids duplicating
share_mode_forall_dump_fn() and share_mode_forall_fn() and has the benefit of
code sharing of these functions for both read-only and read-write cases.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/g_lock: add g_lock_locks() and g_lock_locks_read() varients
Ralph Boehme [Sat, 12 Oct 2024 14:36:21 +0000 (16:36 +0200)] 
s3/g_lock: add g_lock_locks() and g_lock_locks_read() varients

Gives callers the option to modify data if needed. All existing
callers use g_lock_locks_read(), so no change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: add a test for recursive h-lease break when renaming
Ralph Boehme [Wed, 2 Oct 2024 05:47:25 +0000 (07:47 +0200)] 
smbtorture: add a test for recursive h-lease break when renaming

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add handle lease breaking when deleting files in tree disconnect
Ralph Boehme [Sat, 28 Sep 2024 14:48:31 +0000 (16:48 +0200)] 
smbd: add handle lease breaking when deleting files in tree disconnect

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: let smbd_server_connection_terminate_ex() always go through smbXsrv_connection_...
Ralph Boehme [Sat, 28 Sep 2024 14:44:31 +0000 (16:44 +0200)] 
smbd: let smbd_server_connection_terminate_ex() always go through smbXsrv_connection_shutdown_send()

This ensures common cleanup code via

  smbXsrv_connection_shutdown_send() ->
  -> smbXsrv_session_disconnect_xconn()
  -> smbXsrv_session_remove_channel()
  -> smb2srv_session_shutdown_send()

is used if the last (only) connection goes away as well. In the future this
should be implemented for the

  xconn->has_cluster_movable_ip

case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: smbd_server_connection_terminate() may return
Ralph Boehme [Tue, 22 Oct 2024 05:56:53 +0000 (07:56 +0200)] 
smbd: smbd_server_connection_terminate() may return

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: add handle lease breaking when deleting files at session shutdown time
Ralph Boehme [Tue, 17 Sep 2024 05:16:51 +0000 (07:16 +0200)] 
smbd: add handle lease breaking when deleting files at session shutdown time

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: check initial-delete-on-close breaks H-lease for tdis, logoff and disconnect
Ralph Boehme [Sat, 14 Sep 2024 11:22:20 +0000 (13:22 +0200)] 
smbtorture: check initial-delete-on-close breaks H-lease for tdis, logoff and disconnect

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: use delay_for_handle_lease_break_send() for initial delete on close
Ralph Boehme [Sat, 14 Sep 2024 17:19:51 +0000 (19:19 +0200)] 
smbd: use delay_for_handle_lease_break_send() for initial delete on close

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: break handle leases when setting SMB_FILE_DISPOSITION_INFORMATION
Ralph Boehme [Mon, 14 Oct 2024 16:47:48 +0000 (18:47 +0200)] 
smbd: break handle leases when setting SMB_FILE_DISPOSITION_INFORMATION

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: split out smb_check_file_disposition_info()
Ralph Boehme [Fri, 11 Oct 2024 13:30:46 +0000 (15:30 +0200)] 
smbd: split out smb_check_file_disposition_info()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbtorture: expand test test_lease_unlink() with set-delete-on-close
Ralph Boehme [Mon, 16 Sep 2024 19:29:10 +0000 (21:29 +0200)] 
smbtorture: expand test test_lease_unlink() with set-delete-on-close

Currently the test only uses initial-delete-on-close. Expand the test to also
use set-delete-on-close.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13458
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: rework async rename check for handle lease breaks
Ralph Boehme [Mon, 16 Sep 2024 00:36:00 +0000 (02:36 +0200)] 
smbd: rework async rename check for handle lease breaks

Add a version of delay_rename_for_lease_break() that is usable in other places
where we have to check for handle lease breaks. No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: use a DATA_BLOB and avoid data copy in delay_rename_for_lease_break()
Ralph Boehme [Fri, 11 Oct 2024 12:25:44 +0000 (14:25 +0200)] 
smbd: use a DATA_BLOB and avoid data copy in delay_rename_for_lease_break()

in_input_buffer just points into the smbd_smb2_request iovecs data which is
guarenteed to have the same lifetime as the deferred rename processing, no need
to make a copy.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: smbd_do_setfilepathinfo(): pass data as pointer, not pointer-to-pointer
Ralph Boehme [Fri, 11 Oct 2024 12:15:32 +0000 (14:15 +0200)] 
smbd: smbd_do_setfilepathinfo(): pass data as pointer, not pointer-to-pointer

No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>