Volker Lendecke [Fri, 23 May 2025 13:22:39 +0000 (15:22 +0200)]
smbd: Simplify inotify_handler()
[sizeof(struct inotify_event) + NAME_MAX + 1] is the recommended
buffer size in "man 7 inotify". Pulling everything out of the inotify
buffer makes sense if we would reliably get the two rename events in
the same read-call. Unfortunately this is not the case, even with a
buffer size of 64k I've seen MOVED_FROM and MOVED_to in separate reads
from the socket. We'll have to take care of this situation next. Until
then, we don't have to FIONREAD and then read everything that's
there. Rather go through another event loop, replacing the ioctl with
a epoll_wait syscall.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15864 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Mon Jun 2 15:10:30 UTC 2025 on atb-devel-224
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu May 29 10:57:35 UTC 2025 on atb-devel-224
Martin Schwenke [Thu, 15 May 2025 04:01:16 +0000 (14:01 +1000)]
ctdb-daemon: Run "startipreallocate" event in SHUTDOWN runstate
Even though all nodes may be shutting down there is still a very small
window for a race when multiple nodes are shut down. For simplicity,
assume 2 nodes. Assume the shutdowns of nodes are staggered, which is
usual because they're usually initiated by a loop (e.g. onnode -p all
ctdb shutdown). Although commands can continue in parallel, some
commands are started later than others.
Consider this sequence:
1. Node 0 reaches ctdb_shutdown_takeover() in
ctdb_shutdown_sequence() and a takeover run starts
2. Node 1 has not yet set its runlevel to SHUTDOWN in
ctdb_shutdown_sequence()
3. The leader node asks node 1 which IPs it can host
4. Node 1 replies "all of them"
5. Node 1 now sets its runlevel to SHUTDOWN in
ctdb_shutdown_sequence()
6. The leader node continues with the takeover run, first asking all
nodes to run "startipreallocate"
7. Node 0 runs "startipreallocate", so its NFS server starts grace
8. Node 1 does not run "startipreallocate" because it is not in
RUNNING runstate, so its NFS server does not start grace
9. The leader node continues with the takeover run, first asking all
nodes to run "releaseip" for IPs they can no longer hold
10. Node 0 releases all IPs, since it is SHUTDOWN runstate (so can't
host IPs)
11. As part of this, the NFS server on node 0 releases locks held
against IPs it is releasing
12. A client connected to node 1, where the NFS server is not in
grace, takes ("steals") one of those locks
This client is then permitted to reclaim the lock when nodes are
restarted.
Martin Schwenke [Mon, 12 May 2025 01:33:19 +0000 (11:33 +1000)]
ctdb-daemon: Add failover on shutdown
Without this, NFS servers on other nodes will not go into grace before
this node releases locks. This should also support improved behaviour
for SMB durable file handles.
The timeout is currently a constant 10s. However, it will
subsequently be switched to an option.
Martin Schwenke [Wed, 14 May 2025 06:55:51 +0000 (16:55 +1000)]
ctdb-protocol: Add CTDB server SRVID range
Normally, communication from other components to ctdbd is done via
controls. However, there are contexts where receiving SRVID messages
in ctdbd makes sense, such as replies to outgoing SRVID messages.
Martin Schwenke [Wed, 21 May 2025 12:17:42 +0000 (22:17 +1000)]
ctdb-daemon: Avoid aborting during early shutdown
An early shutdown can put ctdbd into SHUTDOWN runstate before ctdbd
has completed all early initialisation. Some of the start-time
transitions then attempt to set the runstate to FIRST_RECOVERY or
RUNNING, which would make the runstate go backwards, so ctdbd aborts.
Upcoming changes cause ctdbd shutdown to take longer, so the problem
will become more likely. With those changes, this can be
unreliably (50% of the time?) triggered by:
since it does an early shutdown due to a version mismatch.
Avoid this by noticing when the runstate is SHUTDOWN and refusing to
continue with subsequent early initialisation steps, which aren't
needed when shutting down.
Earlier runstate transitions do not seems likely to cause an abort
during early shutdown. The following:
sees ctdbd already into FIRST_RECOVERY before the shutdown is
processed.
The change to ctdb_run_startup() probably isn't strictly necessary.
There will be no abort in this case. ctdb_shutdown_sequence() will
always run the "shutdown" event and then stop the event daemon, so it
doesn't seem possible that services could be left running. However,
we might as well avoid running the "startup" event when shutting down,
even if only to avoid confusing logs.
Ultimately, it seems like some redesign would be needed to avoid this
in a more predictable manner, rather than responding when an early
initialisation step inconveniently completes during shutdown. For
example, hanging a lot of the start-time event handling off a common
talloc context, could allow it to be cancelled with a single
TALLOC_FREE(). However, a change like that would involve a lot of
analysis to ensure that the talloc hierarchy is correct and there is
no change of free'd pointers being dereferenced. So, we're probably
better off just keeping this issue in mind during a broader redesign.
The lex/flex generated code in the heimdal build triggers:
strict-prototype and implicit-fallthrough errors
Rather that blanket disabling the warnings, try to disable them only
when compiling lex/flex generated code
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu May 29 00:19:50 UTC 2025 on atb-devel-224
Gary Lockyer [Tue, 20 May 2025 21:13:48 +0000 (09:13 +1200)]
heimdal build: pass c flags in HEIMDAL_BINARY
HEIMDAL_CFLAGS clears the cflags variable,
so we need to pass cflags_end to HEIMDAL_SUBSYSTEM to ensure the
subsystem files get built with the intended flags
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Tue, 20 May 2025 21:10:28 +0000 (09:10 +1200)]
Fix clang 20 format-nonliteral warnings
Fix:
/source3/utils/smbcacls.c:1619:35 error:
format string is not a string literal
[-Werror -Wformat-non-literal]
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Mon, 19 May 2025 22:00:26 +0000 (10:00 +1200)]
Fix clang 20 format-truncation warnings
Fix:
lib/replace/tests/testsuite.c:387:6: error:
'snprintf' will always be truncated; specified size is 3,
but format string expands to at least 5 [-Werror,-Wformat-truncation]
387 | if (snprintf(tmp, 3, "foo%d", 9) != 4) {
| ^
As this is an explicit test of snprintf's truncation behaviour
the warning can be safely suppressed.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Mon, 19 May 2025 04:15:27 +0000 (16:15 +1200)]
Fix clang 20 unused-but-set-variables warnings
Suppress error: variable 'yynerrs' set but not used [-Werror,-Wunused-but-set-variable]
for the code generated from the yacc files.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Wed, 21 May 2025 22:34:23 +0000 (10:34 +1200)]
Fix clang 20 sometimes-uninitialized warnings
Fix clang 20:
variable '' is uninitialized where 'if' condition is true
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Wed, 21 May 2025 22:32:50 +0000 (10:32 +1200)]
nsswitch wbinfo: fix uninitialised return value on error
In wbinfo_lookup_sids ret was not initialised and was not set in
the error return paths. Returning an uninitialised value in the
event of an error, and in all probability something that evaluated to
true, so would not have signalled the error to the caller.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Mon, 19 May 2025 02:35:43 +0000 (14:35 +1200)]
Fix clang 20 shadows variable in global scope warning
Fixes:
[4822/4916] Compiling source3/torture/torture.c
../../source3/torture/torture.c:685:6: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
685 | int timezone = smb1cli_conn_server_time_zone(cli->conn);
| ^
/usr/include/time.h:234:17: note: previous declaration is here
234 | extern long int timezone;
| ^
1 error generated.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Gary Lockyer [Mon, 19 May 2025 01:56:10 +0000 (13:56 +1200)]
build: Allow developer builds with clang 20
Disable clang warnings to allow samba to be compiled with clang 20.
Subsequent commits will fix the offending code and re-enable the
warnings.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May 28 16:03:59 UTC 2025 on atb-devel-224
Ralph Boehme [Fri, 23 May 2025 15:06:50 +0000 (17:06 +0200)]
smbd: add access_mask to delay_for_handle_lease_break_send()
No change in behaviour, existing caller all pass SEC_RIGHTS_DIR_ALL. Prepares
for selectively breaking only H-leases if the access_mask of the corresponding
open contains DELETE_ACCESS.
Ralph Boehme [Thu, 22 May 2025 14:57:49 +0000 (16:57 +0200)]
smbd: support breaking leases on an object where we don't have an own internal open
So far, when dealing with the rename destination, we had an internal open on
that which ensured get_existing_share_mode_lock() would always return a
lock.
Subsequently I'll want delay_for_handle_lease_break_send() to be callable on an
object that doesn't have a full internal open including locking.tdb entry, but
merely an open handle from filename_convert_dirfsp().
third_party: Update socket_wrapper to version 1.5.1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May 28 11:04:40 UTC 2025 on atb-devel-224
Jennifer Sutton [Thu, 30 Jan 2025 01:27:10 +0000 (14:27 +1300)]
samba-tool: Fix invalid escape sequences
Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Jo Sutton <jsutton@samba.org>
Autobuild-Date(master): Mon May 26 03:44:44 UTC 2025 on atb-devel-224
Jennifer Sutton [Fri, 11 Apr 2025 00:34:14 +0000 (12:34 +1200)]
python: Fix logging call
ERROR(<class AttributeError>): uncaught exception - RootLogger object has no attribute notice
File "/samba/bin/python/samba/netcmd/__init__.py", line 387, in _run
return self.run(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/samba/bin/python/samba/netcmd/domain/backup.py", line 698, in run
logger.notice("back-up has no sysvol data")
^^^^^^^^^^^^^
Jennifer Sutton [Tue, 28 Jan 2025 01:15:02 +0000 (14:15 +1300)]
samba-tool: Filter confidential attributes out of backups made with the ‘--no-secrets’ option
Without this change, ‘lab domains’ and backups intended not to contain
secrets will still contain confidential information, such as BitLocker
recovery data and KDS root keys. Add a new class that filters these
attributes out.
Samuel Cabrero [Fri, 25 Apr 2025 14:44:16 +0000 (16:44 +0200)]
s3:winbind: Delegate normalize_name_map to the idmap child
Delegate mapping to the idmap child to avoid blocking.
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Thu May 22 13:41:43 UTC 2025 on atb-devel-224
lib/torture: assert that a test doesn't create new talloc children of context->ev
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon May 19 10:13:25 UTC 2025 on atb-devel-224
s4:torture/smb2: let smb2.bench tests start the loop only when everything is ready
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri May 16 13:41:56 UTC 2025 on atb-devel-224
Noel Power [Thu, 8 May 2025 18:16:07 +0000 (19:16 +0100)]
wafsamba: Adjust 'match' logic to override paths in config.check()
messages that match various parts of the configure check progress e.g.
'Checking for library iconv'
'Checking for iconv_open'
'Checking for header iconv.h'
are intercepted and the some path(s) modified with the associated option
value
o buildtools/wafsamba/samba_conftests.py: Add arg_list variable
arg_list contains the argument object returned from
'argparser.ArgumentParser.add_argument' which is called
with the content of the 'match' keyword passed to 'add_option'
stripped out. The content of the 'match' keyword is saved as
an attribute to the arg object appended to arg_list.
o buildtools/wafsamba/samba_waf18.py:
search arg_list (see above) that match and 'msg' argument passed
to arg_list (allowing the dest variable associated with the argument
to be accessed and added to some 'path' used during the 'check' phase
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May 16 10:31:31 UTC 2025 on atb-devel-224
dynconfig/wscript: Adjust default cleanup for waf 2.1.5
Using waf 2.1.5 parser.defaults no longer exists (that's part of
the optparse module and waf 2.1.5 uses argparse)
This patch adjusts the default cleanup for argparse.
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>