]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 weeks agosmbd: Pass fsp instead of filename for parent to mkdir_internals()
Volker Lendecke [Wed, 17 Sep 2025 13:55:57 +0000 (06:55 -0700)] 
smbd: Pass fsp instead of filename for parent to mkdir_internals()

parent_dir_fname->fsp was referenced almost everywhere

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Slightly simplify mkdir_internal()
Volker Lendecke [Wed, 17 Sep 2025 13:49:49 +0000 (06:49 -0700)] 
smbd: Slightly simplify mkdir_internal()

Save a few lines by moving the NULL check out of the if-branches. Swap
branches to avoid a ! in the condition, makes it easier to read for me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Pass fsp instead of filename for parent to file_set_dosmode
Volker Lendecke [Wed, 17 Sep 2025 13:46:51 +0000 (06:46 -0700)] 
smbd: Pass fsp instead of filename for parent to file_set_dosmode

Avoids a call to PARENT_PATHNAME in copy_internals()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Move a variable declaration closer to its use
Volker Lendecke [Wed, 17 Sep 2025 13:05:52 +0000 (06:05 -0700)] 
smbd: Move a variable declaration closer to its use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Simplify rename_internals_fsp()
Volker Lendecke [Thu, 18 Sep 2025 19:50:57 +0000 (12:50 -0700)] 
smbd: Simplify rename_internals_fsp()

Use a new talloc_stackframe to simplify cleanup. I hope Coverity gets
this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Pass src_dirfsp, src_relname and raw newname to rename_internals_fsp()
Volker Lendecke [Wed, 17 Sep 2025 22:51:05 +0000 (15:51 -0700)] 
smbd: Pass src_dirfsp, src_relname and raw newname to rename_internals_fsp()

Will make way for some simplification soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Fix indentation of rename_internals[_fsp] params
Volker Lendecke [Sat, 13 Sep 2025 11:46:52 +0000 (13:46 +0200)] 
smbd: Fix indentation of rename_internals[_fsp] params

Next patches add params

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Return newname from smb2_parse_file_rename_information()
Volker Lendecke [Wed, 17 Sep 2025 22:46:37 +0000 (15:46 -0700)] 
smbd: Return newname from smb2_parse_file_rename_information()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Simplify hardlink_internals()
Volker Lendecke [Tue, 16 Sep 2025 20:15:39 +0000 (13:15 -0700)] 
smbd: Simplify hardlink_internals()

Avoid calling parent_pathref() in hardlink_internals. All but one
callers have the required information anyway. Unfortunately the one
that does not have it is the SMB2 one. So for SMB2+ this is not a real
optimization, but in some distant future we might have a dirfsp
attached to every fsp, so this might at some point also solve itself.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Consolidate [smb|smb2]_file_link_information code
Volker Lendecke [Mon, 15 Sep 2025 18:50:00 +0000 (11:50 -0700)] 
smbd: Consolidate [smb|smb2]_file_link_information code

Those two functions were the same except for pulling the dst name.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Use fsp_is_alternate_stream()
Volker Lendecke [Sat, 13 Sep 2025 09:54:35 +0000 (11:54 +0200)] 
smbd: Use fsp_is_alternate_stream()

This is more descriptive than just checking fsp->base_fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Remove a temp variable used only once
Volker Lendecke [Sat, 13 Sep 2025 09:50:24 +0000 (11:50 +0200)] 
smbd: Remove a temp variable used only once

We use talloc_tos() as function argument in a lot of places already.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Remove a few unnecessary NULL checks
Volker Lendecke [Sat, 13 Sep 2025 09:47:42 +0000 (11:47 +0200)] 
smbd: Remove a few unnecessary NULL checks

These functions are only called from smbd_do_setfilepathinfo() which
has checked with SMB_ASSERT(fsp != NULL).

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Align [smb|smb2]_file_link_information code
Volker Lendecke [Mon, 15 Sep 2025 18:35:46 +0000 (11:35 -0700)] 
smbd: Align [smb|smb2]_file_link_information code

The next patch will merge them into one function. Make it obvious in a separate
patch that they are the same except for parsing the input buffer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Reduce indentation in smb2_parse_file_rename_information()
Volker Lendecke [Sat, 13 Sep 2025 20:34:00 +0000 (22:34 +0200)] 
smbd: Reduce indentation in smb2_parse_file_rename_information()

Avoid an "else"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Simplify hardlink_internals()
Volker Lendecke [Mon, 15 Sep 2025 13:04:06 +0000 (06:04 -0700)] 
smbd: Simplify hardlink_internals()

All callers have easy access to the "new" parent dirfsp and the new
lcomp. Use those to avoid a call to parent_pathref() in
hardlink_internals().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Pass "dirfsp" and the new relname to smb_set_file_unix_hlink()
Volker Lendecke [Mon, 15 Sep 2025 03:10:58 +0000 (20:10 -0700)] 
smbd: Pass "dirfsp" and the new relname to smb_set_file_unix_hlink()

Will be passed on next

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Modernize DEBUGs
Volker Lendecke [Mon, 15 Sep 2025 00:04:03 +0000 (17:04 -0700)] 
smbd: Modernize DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Rename "srcfsp"->"src_dirfsp" and "dstfsp"->"dst_dirfsp"
Volker Lendecke [Sat, 13 Sep 2025 14:06:57 +0000 (16:06 +0200)] 
vfs: Rename "srcfsp"->"src_dirfsp" and "dstfsp"->"dst_dirfsp"

Do this in linkat() and renameat() routines. Some modules already had
this, unify on our current convention to name directory fsps.

Looks much larger than it is, most is coming from "git clang-format".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Slightly simplify smbd_do_qfilepathinfo()
Volker Lendecke [Sat, 13 Sep 2025 10:20:34 +0000 (12:20 +0200)] 
smbd: Slightly simplify smbd_do_qfilepathinfo()

Use metadata_fsp() instead of explicitly checking fsp->base_fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Use fsp_str_dbg() in DEBUGs
Volker Lendecke [Fri, 12 Sep 2025 17:16:28 +0000 (19:16 +0200)] 
smbd: Use fsp_str_dbg() in DEBUGs

This removes "git grep fsp_name->base_name" references.

Referencing fsp_name->base_name is potentially racy and affected by

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

This removes some obvious git grep lines, still leaving far too many...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Move a variable declaration closer to its use
Volker Lendecke [Sun, 14 Sep 2025 17:48:08 +0000 (10:48 -0700)] 
smbd: Move a variable declaration closer to its use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Fix indentation in reply_ntrename()
Volker Lendecke [Sun, 14 Sep 2025 18:04:46 +0000 (11:04 -0700)] 
smbd: Fix indentation in reply_ntrename()

Next patch will modify this section, don't confuse
clang-format. Review with git show -w.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Fix a copy&paste error in a comment
Volker Lendecke [Sun, 14 Sep 2025 17:26:13 +0000 (10:26 -0700)] 
smbd: Fix a copy&paste error in a comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Slightly simplify reply_ntrename()
Volker Lendecke [Sun, 14 Sep 2025 17:23:38 +0000 (10:23 -0700)] 
smbd: Slightly simplify reply_ntrename()

We call filename_convert_dirfsp() on the old name. Use the parsing
done there, we don't need to scan for a ":" in reply_ntrename() where
filename_convert_dirfsp() already does it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Implement larger streams in multiple xattrs
Volker Lendecke [Thu, 4 Sep 2025 15:28:26 +0000 (17:28 +0200)] 
vfs: Implement larger streams in multiple xattrs

See the comment at the top of this patch for a description of the data
format.

The lowerlevel xattr_multi routines now take the raw stream name
instead of the xattr name because they have to build up the real xattr
name attached to the file themselves.

The patch is a bit larger than I would like it, but the mechanics in
the _multi() routines don't make sense in isolation, and the rest is
mostly handling the raw_stream_name instead of the xattr_name.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Fix a few signed/unsigned warnings
Volker Lendecke [Thu, 4 Sep 2025 15:07:35 +0000 (17:07 +0200)] 
vfs: Fix a few signed/unsigned warnings

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Add the streams_xattr:ext_prefix parameter
Volker Lendecke [Thu, 4 Sep 2025 14:56:39 +0000 (16:56 +0200)] 
vfs: Add the streams_xattr:ext_prefix parameter

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Protect against an empty stream prefix
Volker Lendecke [Thu, 4 Sep 2025 14:48:07 +0000 (16:48 +0200)] 
vfs: Protect against an empty stream prefix

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs_streams: Add "streams_xattr:max xattrs per stream" parameter
Volker Lendecke [Thu, 4 Sep 2025 11:48:40 +0000 (13:48 +0200)] 
vfs_streams: Add "streams_xattr:max xattrs per stream" parameter

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Pass streams_xattr_config to fremovexattr_multi()
Volker Lendecke [Tue, 2 Sep 2025 14:27:41 +0000 (16:27 +0200)] 
vfs: Pass streams_xattr_config to fremovexattr_multi()

To be used in later patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Pass streams_xattr_config to fgetxattr_multi()
Volker Lendecke [Tue, 2 Sep 2025 10:40:46 +0000 (12:40 +0200)] 
vfs: Pass streams_xattr_config to fgetxattr_multi()

To be used in later patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Pass streams_xattr_config to streams_xattr_get_ea_value_fsp()
Volker Lendecke [Tue, 2 Sep 2025 10:39:54 +0000 (12:39 +0200)] 
vfs: Pass streams_xattr_config to streams_xattr_get_ea_value_fsp()

To be used in later patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Pass streams_xattr_config to get_xattr_size_fsp()
Volker Lendecke [Tue, 2 Sep 2025 10:35:04 +0000 (12:35 +0200)] 
vfs: Pass streams_xattr_config to get_xattr_size_fsp()

To be used in later patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Pass streams_xattr_config to fsetxattr_multi()
Volker Lendecke [Fri, 29 Aug 2025 15:01:57 +0000 (17:01 +0200)] 
vfs: Pass streams_xattr_config to fsetxattr_multi()

To be used in later patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Pass xattr functions through helpers in streams_xattr
Volker Lendecke [Thu, 28 Aug 2025 14:43:22 +0000 (16:43 +0200)] 
vfs: Pass xattr functions through helpers in streams_xattr

To be used in later patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Simplify streams_xattr_get_ea_value_fsp()
Volker Lendecke [Fri, 29 Aug 2025 14:14:51 +0000 (16:14 +0200)] 
vfs: Simplify streams_xattr_get_ea_value_fsp()

We only need the value, no need for struct streams_xattr_ea just
wrapping a blob.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Simplify streams_xattr_get_ea_value_fsp()
Volker Lendecke [Thu, 28 Aug 2025 12:51:22 +0000 (14:51 +0200)] 
vfs: Simplify streams_xattr_get_ea_value_fsp()

We don't care about flags and names in streams_xattr

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Make streams_xattr_get_ea_value_fsp fill a struct of its own
Volker Lendecke [Thu, 28 Aug 2025 12:50:23 +0000 (14:50 +0200)] 
vfs: Make streams_xattr_get_ea_value_fsp fill a struct of its own

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Make a copy of get_ea_value_fsp() in streams_xattr
Volker Lendecke [Thu, 28 Aug 2025 12:33:06 +0000 (14:33 +0200)] 
vfs: Make a copy of get_ea_value_fsp() in streams_xattr

We'll have to modify it to pass the FGETXATTR call through a helper
function for the vfs_streams_xattr case next.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agovfs: Do an early TALLOC_FREE in streams_xattr_openat()
Volker Lendecke [Fri, 29 Aug 2025 13:57:39 +0000 (15:57 +0200)] 
vfs: Do an early TALLOC_FREE in streams_xattr_openat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agosmbd: Simplify samba_private_attr_name()
Volker Lendecke [Wed, 27 Aug 2025 14:40:54 +0000 (16:40 +0200)] 
smbd: Simplify samba_private_attr_name()

We have strnequal for this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agotest: Fix fruit test for local netatalk interop
Volker Lendecke [Thu, 4 Sep 2025 07:45:32 +0000 (09:45 +0200)] 
test: Fix fruit test for local netatalk interop

streams_xattr always appends a '\0'. We'll start to add meaning to
that byte and check it soon, so make the hand-crafted stream follow
that convention.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agotest: Fix shadow copy streams xattr test
Volker Lendecke [Wed, 3 Sep 2025 09:46:49 +0000 (11:46 +0200)] 
test: Fix shadow copy streams xattr test

streams_xattr always appends a '\0'. We'll start to add meaning to
that byte and check it soon, so make the hand-crafted stream follow
that convention

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 weeks agomdssvc: add support for parsing date ranges
Ralph Boehme [Wed, 15 Oct 2025 13:01:16 +0000 (15:01 +0200)] 
mdssvc: add support for parsing date ranges

Example:

  InRange(kMDItemContentCreationDate,$time.iso(2024-12-31T23:00:00Z),$time.iso(2025-12-31T23:00:00Z))

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Oct 20 10:59:03 UTC 2025 on atb-devel-224

2 weeks agomdssvc: add a test for parsing Spotlight date ranges
Ralph Boehme [Fri, 17 Oct 2025 10:38:53 +0000 (12:38 +0200)] 
mdssvc: add a test for parsing Spotlight date ranges

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2 weeks agomdssvc: reduce a log level to DEBUG
Ralph Boehme [Wed, 15 Oct 2025 12:56:51 +0000 (14:56 +0200)] 
mdssvc: reduce a log level to DEBUG

The expression

  InRange(*,$time.iso(2024-12-31T23:00:00Z),$time.iso(2025-12-31T23:00:00Z))

in a Spotlight query produces the following log message:

  map_fts: Mapping fts [757378800] unexpected op [~]

However, when

    elasticsearch:ignore unknown attribute = yes

is set, the parser will ignore the failed expression and continue
parsing given the expression is part of a larger expression like
"subexpression1 OR subexpression2". Avoid spamming the log and reduce
the loglevel when we hit this case.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agothird_party: Update cmocka to version 1.1.8
Andreas Schneider [Wed, 15 Oct 2025 09:39:42 +0000 (11:39 +0200)] 
third_party: Update cmocka to version 1.1.8

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Oct 17 12:16:23 UTC 2025 on atb-devel-224

3 weeks agos4:kdc: Fix cmocka.h include
Andreas Schneider [Fri, 17 Oct 2025 07:10:29 +0000 (09:10 +0200)] 
s4:kdc: Fix cmocka.h include

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agoAdd missing include needed for cmocka.h
Andreas Schneider [Thu, 7 Aug 2025 08:36:51 +0000 (10:36 +0200)] 
Add missing include needed for cmocka.h

This will be required in future.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agoctdb-scripts: Avoid failing updateip when IP is not assigned
Martin Schwenke [Thu, 16 Oct 2025 02:54:22 +0000 (13:54 +1100)] 
ctdb-scripts: Avoid failing updateip when IP is not assigned

There is no use failing this when it could behave more like takeip.

Use old interface of "__none__" as a hint that ctdbd doesn't think the
IP is assigned either.  In this case print a warning instead of an
error.  Take some care to avoid spurious errors in updateip.

After commit 0536d7a98b832fc00d26b09c26bf14fb63dbf5fb (which improves
IP address state checking), this will almost certainly not occur on
platforms with getifaddrs(3) (e.g. Linux).  This means it is only
likely to occur in 4.21 when net.ipv4.ip_nonlocal_bind=1.

Update test to match.

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

Reported-by: Bailey Allison <ballison@45drives.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Oct 17 06:28:30 UTC 2025 on atb-devel-224

3 weeks agoctdb-scripts: Avoid printing a message if no connections
Martin Schwenke [Thu, 16 Oct 2025 02:51:27 +0000 (13:51 +1100)] 
ctdb-scripts: Avoid printing a message if no connections

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agoctdb-tests: Add an event script unit test for updateip
Martin Schwenke [Wed, 15 Oct 2025 23:42:22 +0000 (10:42 +1100)] 
ctdb-tests: Add an event script unit test for updateip

This illustrates the current failure where an unassigned public IP
address causes updateip to fail.

After commit 0536d7a98b832fc00d26b09c26bf14fb63dbf5fb (which improves
IP address state checking), this will almost certainly not occur on
platforms with getifaddrs(3) (e.g. Linux).  This means it is only
likely to occur in 4.21 when net.ipv4.ip_nonlocal_bind=1.

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

Reported-by: Bailey Allison <ballison@45drives.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agoctdb-daemon: Fix a crash due to a failed updateip
Martin Schwenke [Wed, 15 Oct 2025 21:17:44 +0000 (08:17 +1100)] 
ctdb-daemon: Fix a crash due to a failed updateip

This should really be a takeip.  However, CTDB's weak check of the IP
address state (using bind(2)) incorrectly indicates that the IP
address is assigned to an interface so it is converted to an updateip.

After commit 0536d7a98b832fc00d26b09c26bf14fb63dbf5fb (which improves
IP address state checking), this will almost certainly not occur on
platforms with getifaddrs(3) (e.g. Linux).  This means it is only
likely to occur in 4.21 when net.ipv4.ip_nonlocal_bind=1.

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

Reported-by: Bailey Allison <ballison@45drives.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agoCVE-2025-9640: s3/modules/vfs_streams_xattr fix unitialized write
Andrew Walker [Thu, 28 Aug 2025 19:36:19 +0000 (19:36 +0000)] 
CVE-2025-9640: s3/modules/vfs_streams_xattr fix unitialized write

This commit fixes a situation in which vfs_streams_xattr could
write unitialized memory into alternate data streams if the
user writes to an offset that is beyond the current end of file
to insert a hole in it.

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

Signed-off-by: Andrew Walker <andrew.walker@truenas.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Oct 16 19:47:19 UTC 2025 on atb-devel-224

3 weeks agoCVE-2025-9640: Add torture test for inserting hole in stream
Andrew Walker [Thu, 28 Aug 2025 19:39:34 +0000 (19:39 +0000)] 
CVE-2025-9640: Add torture test for inserting hole in stream

This commit adds an smb torture test for inserting a hole into
an alternate data stream and then verifying that hole contains
null bytes.

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

Signed-off-by: Andrew Walker <andrew.walker@truenas.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 weeks agosmbtorture: fix regression in smb2.bench
Ralph Boehme [Wed, 15 Oct 2025 14:30:20 +0000 (16:30 +0200)] 
smbtorture: fix regression in smb2.bench

The changes in b6757378be23 caused a regression where only the first
connection was used.

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

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): Thu Oct 16 18:42:05 UTC 2025 on atb-devel-224

3 weeks agotests: Run `dd` without any preloaded libraries
Andreas Schneider [Tue, 14 Oct 2025 09:57:04 +0000 (11:57 +0200)] 
tests: Run `dd` without any preloaded libraries

If AddressSanitizer is loaded it will detect alignment issues. The tool
is not ours, so ignore it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Oct 16 09:34:58 UTC 2025 on atb-devel-224

3 weeks agos3:util: Pass a memory context to get_challenge for ntlm_auth tests
Andreas Schneider [Tue, 14 Oct 2025 09:21:42 +0000 (11:21 +0200)] 
s3:util: Pass a memory context to get_challenge for ntlm_auth tests

Fixes memory leaks detected by LeakSanitizer.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agos3:utils: Use a talloc stackframe for diagnose_ntlm_auth()
Andreas Schneider [Tue, 14 Oct 2025 09:20:55 +0000 (11:20 +0200)] 
s3:utils: Use a talloc stackframe for diagnose_ntlm_auth()

This way we can use talloc_tos() and don't leak any memory. This will
make LeakSanitizer happy.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 weeks agoctdb-tests: Don't hard code creation of $CTDB_BASE/events/legacy/
Martin Schwenke [Sat, 11 Oct 2025 06:52:32 +0000 (17:52 +1100)] 
ctdb-tests: Don't hard code creation of $CTDB_BASE/events/legacy/

setup_ctdb_base() should always create from etc-ctdb/.  That directory
may be changed to not include the legacy/ component subdirectory, so
don't hard-code this particular subdirectory.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Oct 14 17:57:49 UTC 2025 on atb-devel-224

3 weeks agoctdb-tests: Improve setup_ctdb_base() to fix local_daemons.sh bug
Martin Schwenke [Tue, 7 Oct 2025 11:27:06 +0000 (22:27 +1100)] 
ctdb-tests: Improve setup_ctdb_base() to fix local_daemons.sh bug

$ ctdb/tests/local_daemons.sh foo onnode 0 ctdb event script list legacy
Unable to find event script installation directory: foo/node.0/share/events/legacy

This happens if the $CTDB_BASE/share/events/legacy/ directory does not
exist.  This directory is (theoretically) for installed but not
necessarily enabled event scripts.  ctdb/tests/etc-ctdb/ contains
events/legacy/ but setup_ctdb_base() currently does not ensure
creation of the corresponding directory under $CTDB_BASE/share/.

Ensure that an event script component installation subdirectory exists
for each corresponding configuration subdirectory.

An alternative would be to continue to allow the existing failure, but
create directory ctdb/tests/etc-ctdb/share/events/legacy/ specifically
to make local_daemons.sh work.  However, it took 5 years to find the
current bug, so this may be too subtle for other users of
local_daemons.sh.  Anyone wanting to test the failure case can remove
unwanted subdirectories after "local_daemons.sh setup".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agoctdb-event: Improve error message
Martin Schwenke [Sat, 11 Oct 2025 04:45:09 +0000 (15:45 +1100)] 
ctdb-event: Improve error message

The current message:

  Command script list finished with result=2

does not clearly explain the problem.

Improve it.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agoctdb-tests: Reformat with "shfmt -w -i 0 -fn "
Martin Schwenke [Tue, 7 Oct 2025 11:48:40 +0000 (22:48 +1100)] 
ctdb-tests: Reformat with "shfmt -w -i 0 -fn "

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agos3:libsmb: Fix heap-use-after-free in py_cli_notify_get_changes()
Andreas Schneider [Tue, 14 Oct 2025 09:33:00 +0000 (11:33 +0200)] 
s3:libsmb: Fix heap-use-after-free in py_cli_notify_get_changes()

==556308==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d2f14452360 at pc 0x7baf0a5c3a8b bp 0x7ffe6e1eb2e0 sp 0x7ffe6e1eb2d8                      11:26:39 [1226/65848]
READ of size 4 at 0x7d2f14452360 thread T0
    #0 0x7baf0a5c3a8a in py_cli_notify_get_changes ../../source3/libsmb/pylibsmb.c:2291
    #1 0x7faf165ba239  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1ba239) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #2 0x7faf1658c798 in PyObject_Vectorcall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18c798) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #3 0x7faf165a366e in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1a366e) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #4 0x7faf165db031  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1db031) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #5 0x7faf1659fa1d in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19fa1d) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #6 0x7faf1658ce9b  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18ce9b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #7 0x7faf1667a637  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x27a637) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #8 0x7faf1658a726 in _PyObject_MakeTpCall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18a726) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #9 0x7faf1659ae9b in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19ae9b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #10 0x7faf165db031  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1db031) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #11 0x7faf1659fa1d in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19fa1d) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #12 0x7faf1658ce9b  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18ce9b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #13 0x7faf1667a637  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x27a637) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #14 0x7faf1658a726 in _PyObject_MakeTpCall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18a726) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #15 0x7faf1659ae9b in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19ae9b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #16 0x7faf165db031  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1db031) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #17 0x7faf1659fa1d in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19fa1d) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #18 0x7faf1658ce9b  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18ce9b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #19 0x7faf1667a637  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x27a637) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #20 0x7faf1658a726 in _PyObject_MakeTpCall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18a726) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #21 0x7faf1659e0ae in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19e0ae) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #22 0x7faf165db031  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1db031) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #23 0x7faf1659fa1d in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19fa1d) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #24 0x7faf1658ce9b  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18ce9b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #25 0x7faf1667a637  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x27a637) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #26 0x7faf1658a726 in _PyObject_MakeTpCall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18a726) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #27 0x7faf1659e0ae in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19e0ae) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #28 0x7faf1658cf1b  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18cf1b) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #29 0x7faf165c3c5a  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1c3c5a) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #30 0x7faf1658a9b5  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18a9b5) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #31 0x7faf1658a726 in _PyObject_MakeTpCall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18a726) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #32 0x7faf165a366e in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1a366e) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #33 0x7faf1662f875 in PyEval_EvalCode (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x22f875) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #34 0x7faf166498fc  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x2498fc) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #35 0x7faf165b17fe  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1b17fe) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #36 0x7faf1658c798 in PyObject_Vectorcall (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x18c798) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #37 0x7faf1659e0ae in _PyEval_EvalFrameDefault (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x19e0ae) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #38 0x7faf16664a89  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x264a89) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #39 0x7faf16663a38 in Py_RunMain (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x263a38) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #40 0x7faf1661e3b5 in Py_BytesMain (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x21e3b5) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)
    #41 0x7faf1602b2fa in __libc_start_call_main (/lib64/libc.so.6+0x2b2fa) (BuildId: 8523b213e7586a93ab00f6dd476418b1e521e62c)
    #42 0x7faf1602b3ca in __libc_start_main_impl (/lib64/libc.so.6+0x2b3ca) (BuildId: 8523b213e7586a93ab00f6dd476418b1e521e62c)
    #43 0x564f2695f074 in _start (/usr/bin/python3.13+0x1074) (BuildId: 381e7a168bb2c479b5b88bcfd875777e342d6b45)

0x7d2f14452360 is located 736 bytes inside of 861-byte region [0x7d2f14452080,0x7d2f144523dd)
freed by thread T0 here:
    #0 0x7faf16d208eb  (/lib64/libasan.so.8+0x1208eb) (BuildId: 61b31c4760766f5f2552c32e175755894d8f6565)
    #1 0x7faf14560a72 in _tc_free_poolmem ../../lib/talloc/talloc.c:1080
    #2 0x7faf1455f71b in _tc_free_internal ../../lib/talloc/talloc.c:1215
    #3 0x7faf1455ee1b in _tc_free_children_internal ../../lib/talloc/talloc.c:1669
    #4 0x7faf1455ee1b in _tc_free_internal ../../lib/talloc/talloc.c:1184
    #5 0x7faf14560315 in _talloc_free_internal ../../lib/talloc/talloc.c:1248
    #6 0x7faf14560315 in _talloc_free ../../lib/talloc/talloc.c:1792
    #7 0x7baf0a5c3883 in py_cli_notify_get_changes ../../source3/libsmb/pylibsmb.c:2274
    #8 0x7faf165ba239  (/lib64/glibc-hwcaps/x86-64-v3/libpython3.13.so.1.0+0x1ba239) (BuildId: 3925b60e845f4803e4de04e1fdf7845f2e54ecb0)

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Oct 14 12:35:37 UTC 2025 on atb-devel-224

3 weeks agovfs_fake_acls: Fix error path return in fake_acls_fstatat()
Volker Lendecke [Mon, 13 Oct 2025 09:18:35 +0000 (11:18 +0200)] 
vfs_fake_acls: Fix error path return in fake_acls_fstatat()

Thanks to Jeremy for pointing this out to me!

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Oct 14 08:27:39 UTC 2025 on atb-devel-224

3 weeks agos4:torture:vfs:fruit fix Clang compilation issue
Gary Lockyer [Sun, 12 Oct 2025 20:46:16 +0000 (09:46 +1300)] 
s4:torture:vfs:fruit fix Clang compilation issue

Fix:

[4176/4995] Compiling source4/torture/vfs/fruit.c
../../source4/torture/vfs/fruit.c:7900:2: error: variable 'h' is used
    uninitialized whenever 'if' condition is true
    [-Werror,-Wsometimes-uninitialized]
 7900 |         CHECK_STATUS(status, NT_STATUS_OK);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Oct 13 04:42:16 UTC 2025 on atb-devel-224

3 weeks agos4:kdc:db-glue-tests Fix CID 1666664
Gary Lockyer [Sun, 12 Oct 2025 20:44:49 +0000 (09:44 +1300)] 
s4:kdc:db-glue-tests Fix CID 1666664

Fix Coverity issue CID 1666664

115      char* ts = ldb_timestring(msg, created);
>>>     CID 1666664:         Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a pointer that might be "NULL" "ts" when calling
>>>     "ldb_msg_add_string".
116      ldb_msg_add_string(msg, "whenCreated", ts);

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 weeks agosmbd: only increment lease epoch if a lease was granted
Ralph Boehme [Tue, 23 Sep 2025 12:14:22 +0000 (14:14 +0200)] 
smbd: only increment lease epoch if a lease was granted

From MS-SMB2 3.3.5.9.11 "Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create
Context":

  If the object store succeeds this request, Lease.LeaseState MUST be set to the
  new caching state.  The server MUST increment Lease.Epoch by 1.

try_lease_upgrade() already has the same logic when checking for a possible
upgrade of an exisiting lease.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Oct 10 17:02:26 UTC 2025 on atb-devel-224

4 weeks agosmbtorture: add test "smb2.lease.lease-epoch"
Ralph Boehme [Sat, 27 Sep 2025 11:01:32 +0000 (13:01 +0200)] 
smbtorture: add test "smb2.lease.lease-epoch"

Verifies the lease epoch is not incremented by the server (returns what the
client sent in the request) if a lease was not granted ie lease_level=NONE.

Test passes against Windows 2025.

From MS-SMB2 3.3.5.9.11 "Handling the SMB2_CREATE_REQUEST_LEASE_V2 Create
Context":

  If the object store succeeds this request, Lease.LeaseState MUST be set to the
  new caching state.  The server MUST increment Lease.Epoch by 1.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbtorture: correctly handle scale-out shares in smb2.durable-v2-open.[persistent...
Ralph Boehme [Sat, 4 Aug 2018 14:40:14 +0000 (16:40 +0200)] 
smbtorture: correctly handle scale-out shares in smb2.durable-v2-open.[persistent-]open-oplock

This ensures the tests work correctly against Windows on cluster shares with and
without SMB2_SHARE_CAP_SCALEOUT.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbtorture: correctly handle scale-out shares in smb2.durable-v2-open.create-blob
Ralph Boehme [Fri, 28 Feb 2025 05:15:26 +0000 (06:15 +0100)] 
smbtorture: correctly handle scale-out shares in smb2.durable-v2-open.create-blob

On a share with SMB2_SHARE_CAP_SCALEOUT capability the cluster doesn't
grant batch oplocks, at most level-II oplocks and it also doesn't
grant durable-handles (v1 or v2) as they require an RWH-lease.

With this change the test passes against Windows Server 2025.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbtorture: fix smb2.durable-v2-open.open-lease and smb2.durable-v2-open.persistent...
Ralph Boehme [Wed, 9 May 2018 06:25:51 +0000 (08:25 +0200)] 
smbtorture: fix smb2.durable-v2-open.open-lease and smb2.durable-v2-open.persistent-open-lease

Only check the resulting lease state if we actually requested a lease and
correctly deal with SMB2_SHARE_CAP_SCALEOUT shares where the server grants at
most R leases and no Durable Handles.

With this change the test passes against Windows Server 2025.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbstatus: avoid a crash with --json output if the access_mask has SEC_STD_WRITE_OWNER
Ralph Boehme [Wed, 16 Jul 2025 14:50:25 +0000 (16:50 +0200)] 
smbstatus: avoid a crash with --json output if the access_mask has SEC_STD_WRITE_OWNER

This was missing in access_mask[] triggering an assert when printing the access
mask string:

 ...
 #4  0x00007ffff79553cc in smb_panic (why=0x207b5c "assert failed: tomap == 0") at ../../lib/util/fault.c:209
 #5  0x000000000021ea2c in map_mask_to_json (root_json=0x7fffffffcd60, tomap=524288, table=0x223440 <access_mask>) at ../../source3/utils/status_json.c:142
 ...

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: avoid clobbering the file size, use info instead
Ralph Boehme [Wed, 24 Sep 2025 17:30:08 +0000 (19:30 +0200)] 
smbd: avoid clobbering the file size, use info instead

This is a better implementation of 215b2c741a93023d13e8a9f82739ac3e91b64a66 and
also prepares for future changes where I'll need the current size.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: move lp_locking() check inside file_has_brlocks()
Ralph Boehme [Mon, 22 Sep 2025 15:28:23 +0000 (17:28 +0200)] 
smbd: move lp_locking() check inside file_has_brlocks()

Avoids doing the check at every caller.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: remove remnants from write cache handling which was removed a long time ago
Ralph Boehme [Wed, 1 Oct 2025 09:45:43 +0000 (11:45 +0200)] 
smbd: remove remnants from write cache handling which was removed a long time ago

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agos3:smbd: remove an else branch in exit_server_common()
Ralph Boehme [Sun, 25 Feb 2018 08:48:53 +0000 (09:48 +0100)] 
s3:smbd: remove an else branch in exit_server_common()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: fix handing of oplock_request and INTERNAL_OPEN_ONLY
Ralph Boehme [Sun, 24 Aug 2025 06:45:39 +0000 (08:45 +0200)] 
smbd: fix handing of oplock_request and INTERNAL_OPEN_ONLY

Avoid overwriting INTERNAL_OPEN_ONLY in oplock_request and fix setting
oplock_request to INTERNAL_OPEN_ONLY.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agos3/rpc_server: fix "log file = %m"
Ralph Boehme [Sat, 27 Sep 2025 10:02:35 +0000 (12:02 +0200)] 
s3/rpc_server: fix "log file = %m"

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd-scavenger: call set_remote_machine_name()
Ralph Boehme [Sat, 27 Sep 2025 09:32:29 +0000 (11:32 +0200)] 
smbd-scavenger: call set_remote_machine_name()

Makes "log file = %m" work.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd-cleanupd: call set_remote_machine_name() and reopen_logs()
Ralph Boehme [Sat, 27 Sep 2025 09:32:02 +0000 (11:32 +0200)] 
smbd-cleanupd: call set_remote_machine_name() and reopen_logs()

Makes "log file = %m" work.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd-notifyd: call set_remote_machine_name()
Ralph Boehme [Sat, 27 Sep 2025 09:31:04 +0000 (11:31 +0200)] 
smbd-notifyd: call set_remote_machine_name()

Makes "log file = %m" work.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agos3/locking: comment reformatting
Ralph Boehme [Thu, 17 Jul 2025 09:23:34 +0000 (11:23 +0200)] 
s3/locking: comment reformatting

Prepares for upcoming changes.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: use op->global->open_global_id for the share_mode_entry.share_file_id
Ralph Boehme [Thu, 9 Oct 2025 13:27:31 +0000 (15:27 +0200)] 
smbd: use op->global->open_global_id for the share_mode_entry.share_file_id

open_global_id is an uint32_t, share_file_id is an uint64_t.

For internal opens that don't have an smbXsrv_open_global.tdb entry, continue to
use a generation counter starting at UINT32_MAX + 1.

We don't expose internal opens via srvsrc, which imposes the requirement for
using an uint32_t, so we can use larger ids for the internal opens as srvsvc
never sees them (as they're not in smbXsrv_open_global.tdb and srvsvc as any
other component listing open files like smbstatus lists smbXsrv_open_global.tdb).

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Oct 10 11:43:16 UTC 2025 on atb-devel-224

4 weeks agosmbd: move calling fsp_set_gen_id() to fsp_bind_smb()
Ralph Boehme [Thu, 9 Oct 2025 13:17:38 +0000 (15:17 +0200)] 
smbd: move calling fsp_set_gen_id() to fsp_bind_smb()

No change in behaviour. fsp_set_gen_id() sets the primary key for the
share_mode_entry of the corresponding open file handle. None of the pathref fsp
needs that before being passed to SMB_VFS_CREATE_FILE().

As file_new() calls fsp_bind_smb(), all fsps will get an id when
create_file_unixpath() either calls file_new when creating files or it calls
fsp_bind_smb() when "converting" an pathref fsp that was passed into
SMB_VFS_CREATE_FILE() to an FSA fsp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agomdssvc: implement elasticsearch:default_fields
Ralph Boehme [Mon, 1 Sep 2025 12:55:04 +0000 (14:55 +0200)] 
mdssvc: implement elasticsearch:default_fields

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agomdssvc: fix filtering by share path prefix
Ralph Boehme [Thu, 4 Sep 2025 15:41:44 +0000 (17:41 +0200)] 
mdssvc: fix filtering by share path prefix

To correctly filter by share path, use a filter with a prefix match.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agomdssvc: fix running test command manually
Ralph Boehme [Thu, 2 Oct 2025 15:08:55 +0000 (17:08 +0200)] 
mdssvc: fix running test command manually

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agovfs_fruit: ignore Set-ACL requests with zero ACEs
Ralph Boehme [Sat, 6 Sep 2025 06:48:44 +0000 (08:48 +0200)] 
vfs_fruit: ignore Set-ACL requests with zero ACEs

Workaround for a new behaviour in latest macOS versions.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: hang directory pattern matching case sensitivity on the pathname
Ralph Boehme [Thu, 18 Sep 2025 18:35:22 +0000 (20:35 +0200)] 
smbd: hang directory pattern matching case sensitivity on the pathname

For the SMB3 POSIX client both posix_open=true and (fsp->fsp_name->flags &
SMB_FILENAME_POSIX_PATH) will always be the case, so this is no change in
behaviour for that case.

However, for the macOS client fruit will carefully setup both flags as
posix_open=true but SMB_FILENAME_POSIX_PATH will not be set.

This is a deliberate hack to give the macOS client POSIX behaviour for some
operations, but not for others, while also allowing the POSIX-ified macOS client
to continue to get case insensitive behavour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: hang posix brl per-handle check on the pathname
Ralph Boehme [Thu, 18 Sep 2025 21:44:34 +0000 (23:44 +0200)] 
smbd: hang posix brl per-handle check on the pathname

For the SMB3 POSIX client both posix_open=true and (fsp->fsp_name->flags &
SMB_FILENAME_POSIX_PATH) will always be the case, so this is no change in
behaviour for that case.

However, for the macOS client fruit will carefully setup both flags as
posix_open=true but SMB_FILENAME_POSIX_PATH will not be set.

This is a deliberate hack to give the macOS client POSIX behaviour for some
operations, but not for others, while also allowing the POSIX-ified macOS client
to continue to get case insensitive behavour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agovfs_fruit: add option "fruit:posix_opens = yes|no" (default: yes)
Ralph Boehme [Mon, 10 Mar 2025 14:01:42 +0000 (15:01 +0100)] 
vfs_fruit: add option "fruit:posix_opens = yes|no" (default: yes)

Tags alls opens as POSIX by setting fsp_flags.posix_open to true.

POSIX handles have different behaviour compared to Windows:

Behaviour                          | POSIX      | Windows    | macOS     |fruit:posix_opens = yes
-----------------------------------+------------+----------------------------------------
Deleting files with open handles   | yes        | no         | yes       | yes
Moving directories with open files | yes        | no         | yes       | yes
Byterange locks behaviour          | POSIX-ish  | Window-ish | POSIX-ish | POSIX-ish
Sticky writetime                   | no         | yes        | no        | no
Case sensitive                     | no         | yes        | yes       | yes
Streams allowed                    | no         | yes        | yes       | yes

macOS follows POSIX for the first four, but needs case insensitive behaviour
and needs streams.

By carefully setting fsp_flags.posix_open to true *after* going through the path
resolution logic, but before opens are added to locking.tdb, with
"fruit:posix_opens = yes" we get closest to macOS semantics.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbtorture: add test vfs.fruit.case_insensitive_find
Ralph Boehme [Fri, 19 Sep 2025 04:43:57 +0000 (06:43 +0200)] 
smbtorture: add test vfs.fruit.case_insensitive_find

Verifies case insensitive directory scanning works.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbtorture: add test vfs.fruit.readonly-exclusive-lock
Ralph Boehme [Thu, 18 Sep 2025 22:20:43 +0000 (00:20 +0200)] 
smbtorture: add test vfs.fruit.readonly-exclusive-lock

Verify macOS clients get Windows byterange lock behavour by trying to set an
exclusive lock on a file opened in read-only mode.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbd: don't use sticky write times on POSIX handles
Ralph Boehme [Fri, 1 Aug 2025 15:28:04 +0000 (17:28 +0200)] 
smbd: don't use sticky write times on POSIX handles

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agosmbtorture: fix locking offset in test_fruit_locking_conflict()
Ralph Boehme [Wed, 13 Aug 2025 15:02:16 +0000 (17:02 +0200)] 
smbtorture: fix locking offset in test_fruit_locking_conflict()

AD_FILELOCK_RSRC_DENY_WR = AD_FILELOCK_BASE + 6
 = (0x7FFFFFFFFFFFFFFF - 9) + 6
 = 0x7FFFFFFFFFFFFFFC

No change in behaviour though, just stumpled across it.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 weeks agovfs_fake_acls: Call fake_acls_fstatat() from fake_acls_[l]stat()
Volker Lendecke [Sat, 4 Oct 2025 16:55:42 +0000 (18:55 +0200)] 
vfs_fake_acls: Call fake_acls_fstatat() from fake_acls_[l]stat()

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): Fri Oct 10 09:26:47 UTC 2025 on atb-devel-224

4 weeks agovfs_fake_acls: Implement fake_acls_fstatat()
Volker Lendecke [Sat, 4 Oct 2025 16:51:20 +0000 (18:51 +0200)] 
vfs_fake_acls: Implement fake_acls_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 weeks agovfs_fake_acls: Reduce indentation in fake_acls_stat()
Volker Lendecke [Sat, 4 Oct 2025 16:36:47 +0000 (18:36 +0200)] 
vfs_fake_acls: Reduce indentation in fake_acls_stat()

Use an early error return

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>