The branch, master has been updated via 8831eec914a docs-xml: enable SMB3 Unix Extensions by default via a2f127db4a3 s3/param: remove widelinks check and warning for SMB3 UNIX Extensions via e8b49a59ee4 s3:locking: make sure brl_conflict_posix() is only called with 2 POSIX_LOCKS via 0a1e3638154 s3:locking: assert POSIX_LOCK in brl_[un]lock_posix() via c779bb7c858 s3:locking: init_strict_lock_struct() already calls lp_posix_cifsu_locktype() via 2bdf72a8227 smbd: fix lock_flav initialization in smbd_smb2_lock_send() via ce8a65054d5 smbd: fix check for POSIX opens in have_file_open_below() via 6e662bf5781 smbd: fix checks for POSIX opens in file_find_subpath() from a96f0542c83 vfs_ceph_new: Do not resolve by inode number
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 8831eec914a37f5b60f86020656ddbd9d1c951e4 Author: Ralph Boehme <s...@samba.org> Date: Wed Mar 5 18:02:39 2025 +0100 docs-xml: enable SMB3 Unix Extensions by default Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Ralph Böhme <s...@samba.org> Autobuild-Date(master): Fri Mar 7 20:06:31 UTC 2025 on atb-devel-224 commit a2f127db4a3184f68844c75bcaf8bd1927bfb17c Author: Ralph Boehme <s...@samba.org> Date: Wed Mar 5 18:00:33 2025 +0100 s3/param: remove widelinks check and warning for SMB3 UNIX Extensions SMB3 POSIX clients won't be able to create real symlinks, so we can relax these checks. Signed-off-by: Ralph Boehme <s...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> commit e8b49a59ee424b77942d0e68eb97f3e267264a09 Author: Ralph Boehme <s...@samba.org> Date: Fri Mar 7 14:51:26 2025 +0100 s3:locking: make sure brl_conflict_posix() is only called with 2 POSIX_LOCKS Otherwise we hit the assert if the caller is a windows lock and the conflicting one a posix lock. Or in the non-developer build we don't enforce the windows locking rules. Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Ralph Boehme <s...@samba.org> Signed-off-by: Stefan Metzmacher <me...@samba.org> commit 0a1e3638154f955b9383517af2ca4192bf81046f Author: Ralph Boehme <s...@samba.org> Date: Fri Mar 7 14:47:49 2025 +0100 s3:locking: assert POSIX_LOCK in brl_[un]lock_posix() This makes it clearer and prevents possible problems in future. Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Ralph Boehme <s...@samba.org> Signed-off-by: Stefan Metzmacher <me...@samba.org> commit c779bb7c8584ba9ba5961ecfeb6ba2e5089c6312 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Mar 7 13:50:54 2025 +0100 s3:locking: init_strict_lock_struct() already calls lp_posix_cifsu_locktype() There is no need to do it in the caller and pass an unused argument. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 2bdf72a822758e50655542a844a59861bdd779ff Author: Ralph Boehme <s...@samba.org> Date: Fri Mar 7 14:14:32 2025 +0100 smbd: fix lock_flav initialization in smbd_smb2_lock_send() Right above we did if (posix_handle) { locks[i].lock_flav = POSIX_LOCK; } else { locks[i].lock_flav = WINDOWS_LOCK; } which came in with commit f68fffa85d1de992384a210bb0b9261cda3fb168, apparently forgetting to remove the previously existing initialization locks[i].lock_flav=WINDOWS_LOCK. Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Ralph Boehme <s...@samba.org> Signed-off-by: Stefan Metzmacher <me...@samba.org> commit ce8a65054d59c0eca7317a6e34b20b138e17393b Author: Ralph Boehme <s...@samba.org> Date: Fri Mar 7 12:57:24 2025 +0100 smbd: fix check for POSIX opens in have_file_open_below() Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Ralph Boehme <s...@samba.org> Signed-off-by: Stefan Metzmacher <me...@samba.org> commit 6e662bf5781728e048c560eafe00c4bb6f0db316 Author: Ralph Boehme <s...@samba.org> Date: Fri Mar 7 12:57:07 2025 +0100 smbd: fix checks for POSIX opens in file_find_subpath() Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Ralph Boehme <s...@samba.org> Signed-off-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/smbdotconf/protocol/smb3unixextensions.xml | 4 ++-- lib/param/loadparm.c | 2 ++ source3/locking/brlock.c | 12 +++++++----- source3/locking/locking.c | 1 - source3/locking/proto.h | 1 - source3/modules/vfs_default.c | 4 ---- source3/param/loadparm.c | 9 ++------- source3/smbd/dir.c | 7 +++++-- source3/smbd/files.c | 4 +++- source3/smbd/smb1_aio.c | 2 -- source3/smbd/smb1_reply.c | 8 -------- source3/smbd/smb2_aio.c | 2 -- source3/smbd/smb2_ioctl_filesys.c | 1 - source3/smbd/smb2_lock.c | 1 - source3/smbd/smb2_read.c | 1 - source3/smbd/smb2_write.c | 1 - 16 files changed, 21 insertions(+), 39 deletions(-) Changeset truncated at 500 lines: diff --git a/docs-xml/smbdotconf/protocol/smb3unixextensions.xml b/docs-xml/smbdotconf/protocol/smb3unixextensions.xml index 4c0319976a7..269cf52962c 100644 --- a/docs-xml/smbdotconf/protocol/smb3unixextensions.xml +++ b/docs-xml/smbdotconf/protocol/smb3unixextensions.xml @@ -3,7 +3,7 @@ type="boolean" xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> <description> - <para>Experimental SMB 3.1.1 Unix Extensions.</para> + <para>Support for SMB 3.1.1 Unix Extensions.</para> </description> - <value type="default">no</value> + <value type="default">yes</value> </samba:parameter> diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index ae397330598..30a45511cb8 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -3080,6 +3080,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lpcfg_do_global_parameter(lp_ctx, "smb3 directory leases", "Auto"); + lpcfg_do_global_parameter(lp_ctx, "smb3 unix extensions", "yes"); + lpcfg_do_global_parameter(lp_ctx, "server multi channel support", "yes"); lpcfg_do_global_parameter(lp_ctx, "kerberos encryption types", "all"); diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index b0295174954..0c5dab19389 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -246,10 +246,8 @@ static bool brl_conflict(const struct lock_struct *lck1, static bool brl_conflict_posix(const struct lock_struct *lck1, const struct lock_struct *lck2) { -#if defined(DEVELOPER) SMB_ASSERT(lck1->lock_flav == POSIX_LOCK); SMB_ASSERT(lck2->lock_flav == POSIX_LOCK); -#endif /* Read locks never conflict. */ if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) { @@ -757,6 +755,8 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck, bool break_oplocks = false; NTSTATUS status; + SMB_ASSERT(plock->lock_flav == POSIX_LOCK); + /* No zero-zero locks for POSIX. */ if (plock->start == 0 && plock->size == 0) { return NT_STATUS_INVALID_PARAMETER; @@ -1024,6 +1024,8 @@ static bool brl_unlock_posix(struct byte_range_lock *br_lck, struct lock_struct *locks = br_lck->lock_data; bool overlap_found = False; + SMB_ASSERT(plock->lock_flav == POSIX_LOCK); + /* No zero-zero locks for POSIX. */ if (plock->start == 0 && plock->size == 0) { return False; @@ -1272,10 +1274,10 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, const struct lock_struct *exlock = &locks[i]; bool conflict = False; - if (exlock->lock_flav == WINDOWS_LOCK) { - conflict = brl_conflict(exlock, &lock); - } else { + if (lock_flav == POSIX_LOCK && exlock->lock_flav == POSIX_LOCK) { conflict = brl_conflict_posix(exlock, &lock); + } else { + conflict = brl_conflict(exlock, &lock); } if (conflict) { diff --git a/source3/locking/locking.c b/source3/locking/locking.c index dd963e4fbaa..fefbf88f20a 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -91,7 +91,6 @@ void init_strict_lock_struct(files_struct *fsp, br_off start, br_off size, enum brl_type lock_type, - enum brl_flavour lock_flav, struct lock_struct *plock) { SMB_ASSERT(lock_type == READ_LOCK || lock_type == WRITE_LOCK); diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 8e03ad8cf5a..adfe5fede8f 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -98,7 +98,6 @@ void init_strict_lock_struct(files_struct *fsp, br_off start, br_off size, enum brl_type lock_type, - enum brl_flavour lock_flav, struct lock_struct *plock); bool strict_lock_check_default(files_struct *fsp, struct lock_struct *plock); diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 5d16cbb5bf3..d0cdffa790a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2337,7 +2337,6 @@ static NTSTATUS vfswrap_offload_fast_copy(struct tevent_req *req, int fsctl) state->src_off, state->remaining, READ_LOCK, - lp_posix_cifsu_locktype(state->src_fsp), &lck); ok = SMB_VFS_STRICT_LOCK_CHECK(state->src_fsp->conn, @@ -2357,7 +2356,6 @@ static NTSTATUS vfswrap_offload_fast_copy(struct tevent_req *req, int fsctl) state->dst_off, state->remaining, WRITE_LOCK, - lp_posix_cifsu_locktype(state->dst_fsp), &lck); ok = SMB_VFS_STRICT_LOCK_CHECK(state->dst_fsp->conn, @@ -2453,7 +2451,6 @@ static NTSTATUS vfswrap_offload_write_loop(struct tevent_req *req) state->src_off, state->next_io_size, READ_LOCK, - lp_posix_cifsu_locktype(state->src_fsp), &read_lck); ok = SMB_VFS_STRICT_LOCK_CHECK(state->src_fsp->conn, @@ -2517,7 +2514,6 @@ static void vfswrap_offload_write_read_done(struct tevent_req *subreq) state->dst_off, state->next_io_size, WRITE_LOCK, - lp_posix_cifsu_locktype(state->dst_fsp), &write_lck); ok = SMB_VFS_STRICT_LOCK_CHECK(state->dst_fsp->conn, diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index e04288d2304..9e528e395f1 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -259,6 +259,7 @@ static const struct loadparm_service _sDefault = .spotlight_backend = SPOTLIGHT_BACKEND_NOINDEX, .honor_change_notify_privilege = false, .volume_serial_number = -1, + .smb3_unix_extensions = true, .dummy = "" }; @@ -4740,12 +4741,6 @@ void widelinks_warning(int snum) "These parameters are incompatible. " "Wide links will be disabled for this share.\n", lp_const_servicename(snum)); - } else if (lp_smb3_unix_extensions(snum)) { - DBG_ERR("Share '%s' has wide links and SMB3 Unix " - "extensions enabled. " - "These parameters are incompatible. " - "Wide links will be disabled for this share.\n", - lp_const_servicename(snum)); } } } @@ -4753,7 +4748,7 @@ void widelinks_warning(int snum) bool lp_widelinks(int snum) { /* wide links is always incompatible with unix extensions */ - if (lp_smb1_unix_extensions() || lp_smb3_unix_extensions(snum)) { + if (lp_smb1_unix_extensions()) { /* * Unless we have "allow insecure widelinks" * turned on. diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index afc9c74dfdd..f934ae74019 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1293,6 +1293,7 @@ void RewindDir(struct smb_Dir *dir_hnd) } struct have_file_open_below_state { + bool dirfsp_is_posix; bool found_one; }; @@ -1307,7 +1308,9 @@ static int have_file_open_below_fn(const struct share_mode_data *data, return 0; } - if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) { + if (state->dirfsp_is_posix && + e->flags & SHARE_MODE_FLAG_POSIX_OPEN) + { /* Ignore POSIX opens */ return 0; } @@ -1324,7 +1327,7 @@ static int have_file_open_below_fn(const struct share_mode_data *data, bool have_file_open_below(struct files_struct *fsp) { struct have_file_open_below_state state = { - .found_one = false, + .dirfsp_is_posix = fsp->fsp_flags.posix_open, }; int ret; diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 01af0162845..ea8542b6ba4 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -2203,7 +2203,9 @@ bool file_find_subpath(files_struct *dir_fsp) if (fsp == dir_fsp) { continue; } - if (fsp->fsp_flags.posix_open) { + if (dir_fsp->fsp_flags.posix_open && + fsp->fsp_flags.posix_open) + { continue; } diff --git a/source3/smbd/smb1_aio.c b/source3/smbd/smb1_aio.c index d54a3727312..a242c4112aa 100644 --- a/source3/smbd/smb1_aio.c +++ b/source3/smbd/smb1_aio.c @@ -86,7 +86,6 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn, (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK, - lp_posix_cifsu_locktype(fsp), &aio_ex->lock); /* Take the lock until the AIO completes. */ @@ -250,7 +249,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn, (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &aio_ex->lock); /* Take the lock until the AIO completes. */ diff --git a/source3/smbd/smb1_reply.c b/source3/smbd/smb1_reply.c index d3f08a53706..bcfdf96c633 100644 --- a/source3/smbd/smb1_reply.c +++ b/source3/smbd/smb1_reply.c @@ -3098,7 +3098,6 @@ void reply_readbraw(struct smb_request *req) (uint64_t)startpos, (uint64_t)maxcount, READ_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -3368,7 +3367,6 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", (uint64_t)startpos, (uint64_t)numtoread, READ_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -3449,7 +3447,6 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -3975,7 +3972,6 @@ void reply_writebraw(struct smb_request *req) (uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -4195,7 +4191,6 @@ void reply_writeunlock(struct smb_request *req) (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -4331,7 +4326,6 @@ void reply_write(struct smb_request *req) (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -4632,7 +4626,6 @@ void reply_write_and_X(struct smb_request *req) (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { @@ -5341,7 +5334,6 @@ void reply_writeclose(struct smb_request *req) (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { diff --git a/source3/smbd/smb2_aio.c b/source3/smbd/smb2_aio.c index fc97bdc075a..85e17ab551b 100644 --- a/source3/smbd/smb2_aio.c +++ b/source3/smbd/smb2_aio.c @@ -368,7 +368,6 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn, (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK, - lp_posix_cifsu_locktype(fsp), &aio_ex->lock); /* Take the lock until the AIO completes. */ @@ -517,7 +516,6 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn, in_offset, (uint64_t)in_data.length, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &aio_ex->lock); /* Take the lock until the AIO completes. */ diff --git a/source3/smbd/smb2_ioctl_filesys.c b/source3/smbd/smb2_ioctl_filesys.c index 1a8d1c2affa..1fa0eea632a 100644 --- a/source3/smbd/smb2_ioctl_filesys.c +++ b/source3/smbd/smb2_ioctl_filesys.c @@ -460,7 +460,6 @@ static NTSTATUS fsctl_zero_data(TALLOC_CTX *mem_ctx, zdata_info.file_off, len, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lck); if (!SMB_VFS_STRICT_LOCK_CHECK(fsp->conn, fsp, &lck)) { diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index b90fbb1dfcb..d39066c906f 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -460,7 +460,6 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, } else { locks[i].brltype = UNLOCK_LOCK; } - locks[i].lock_flav = WINDOWS_LOCK; DBG_DEBUG("index %"PRIu16" offset=%"PRIu64", count=%"PRIu64", " "smblctx = %"PRIu64" type %d\n", diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index fc207850c91..3affa8a3317 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -579,7 +579,6 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, in_offset, in_length, READ_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c index 87f6640a085..2c26f838571 100644 --- a/source3/smbd/smb2_write.c +++ b/source3/smbd/smb2_write.c @@ -387,7 +387,6 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, in_offset, in_data.length, WRITE_LOCK, - lp_posix_cifsu_locktype(fsp), &lock); if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) { -- Samba Shared Repository