]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 weeks agolibcli/smb: merge smb_transport library into cli_smb_common
Stefan Metzmacher [Wed, 7 May 2025 19:35:24 +0000 (21:35 +0200)] 
libcli/smb: merge smb_transport library into cli_smb_common

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agoasync_sock: add wait_for_error_send/recv
Stefan Metzmacher [Tue, 20 May 2025 18:20:30 +0000 (20:20 +0200)] 
async_sock: add wait_for_error_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agoasync_sock: move samba_socket_{poll,sock,poll_or_sock}_error() from util_net.c to...
Stefan Metzmacher [Thu, 22 May 2025 08:06:53 +0000 (10:06 +0200)] 
async_sock: move samba_socket_{poll,sock,poll_or_sock}_error() from util_net.c to async_sock.c

The change to LGPL is also intended.

It will be used in the the next commit that adds
wait_for_error_send/recv.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agolibcli/named_pipe_auth: add tstream_npa_monitor_send/recv
Stefan Metzmacher [Wed, 21 May 2025 13:08:42 +0000 (15:08 +0200)] 
libcli/named_pipe_auth: add tstream_npa_monitor_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agolib/tsocket: implement tstream_bsd_monitor_send/recv
Stefan Metzmacher [Wed, 21 May 2025 12:57:15 +0000 (14:57 +0200)] 
lib/tsocket: implement tstream_bsd_monitor_send/recv

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agolib/tsocket: add tstream_monitor_send/recv infrastructure
Stefan Metzmacher [Thu, 15 May 2025 10:01:12 +0000 (12:01 +0200)] 
lib/tsocket: add tstream_monitor_send/recv infrastructure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agolib/tsocket: allow only one tstream_disconnect_send/recv
Stefan Metzmacher [Fri, 16 May 2025 08:04:25 +0000 (10:04 +0200)] 
lib/tsocket: allow only one tstream_disconnect_send/recv

And don't allow readv and writev anymore.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agolib/tsocket: make use of tevent_req_set_cleanup_fn() instead of talloc_set_destructor()
Stefan Metzmacher [Thu, 15 May 2025 12:32:01 +0000 (14:32 +0200)] 
lib/tsocket: make use of tevent_req_set_cleanup_fn() instead of talloc_set_destructor()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agos4:torture/smb2: add explicit timeout handling to async_credits tests
Stefan Metzmacher [Mon, 26 May 2025 11:14:53 +0000 (13:14 +0200)] 
s4:torture/smb2: add explicit timeout handling to async_credits tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agos4:torture/smb2: force a disconnect on all connections as async_credits tests
Stefan Metzmacher [Mon, 26 May 2025 11:01:48 +0000 (13:01 +0200)] 
s4:torture/smb2: force a disconnect on all connections as async_credits tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agos4:torture/smb2: let max_async_credits tests start the loop only when everything...
Stefan Metzmacher [Mon, 26 May 2025 10:21:08 +0000 (12:21 +0200)] 
s4:torture/smb2: let max_async_credits tests start the loop only when everything is ready

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agotevent: version 0.17.0 tevent-0.17.0
Stefan Metzmacher [Fri, 23 May 2025 12:46:15 +0000 (14:46 +0200)] 
tevent: version 0.17.0

- add tevent_context_set_wait_timeout()
- add tevent_reset_immediate()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agotevent: add tevent_reset_immediate()
Stefan Metzmacher [Fri, 23 May 2025 12:26:38 +0000 (14:26 +0200)] 
tevent: add tevent_reset_immediate()

This is a much better api than using
tevent_schedule_immediate() with a NULL handler,
while the tevent_context is still required as argument.

Note the tevent-0.16.2.sigs changes will be reverted in
the 'tevent 0.17.0' commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agotevent: Add tevent_context_set_wait_timeout()
Volker Lendecke [Mon, 10 Mar 2025 20:12:28 +0000 (21:12 +0100)] 
tevent: Add tevent_context_set_wait_timeout()

Mainly to make tevent_loop_once() return immediately with
-1/errno=EAGAIN for polling behaviour.

Note the tevent-0.16.2.sigs changes will be reverted in
the 'tevent 0.17.0' commit.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agolib:util: Disable logging to syslog for startup messages
Andreas Schneider [Tue, 10 Jun 2025 11:46:13 +0000 (13:46 +0200)] 
lib:util: Disable logging to syslog for startup messages

D_ERR also is sent to syslog!

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jun 18 12:10:03 UTC 2025 on atb-devel-224

6 weeks agoEnable clang 20 cast-qual warnings
Gary Lockyer [Tue, 17 Jun 2025 21:03:55 +0000 (09:03 +1200)] 
Enable clang 20 cast-qual warnings

Now that pam_wrapper has been upgraded to 1.1.8, it compiles without
cast-qual warnings.  So lets 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>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Jun 18 06:26:53 UTC 2025 on atb-devel-224

6 weeks agothird_party: Update pam_wrapper to version 1.1.8
Andreas Schneider [Mon, 16 Jun 2025 05:45:21 +0000 (07:45 +0200)] 
third_party: Update pam_wrapper to version 1.1.8

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 17 08:38:35 UTC 2025 on atb-devel-224

6 weeks agopython: Do not interpret 16 character group names as GUIDs
Douglas Bagnall [Fri, 13 Jun 2025 00:29:02 +0000 (12:29 +1200)] 
python: Do not interpret 16 character group names as GUIDs

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Baumbach <bb@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Mon Jun 16 22:22:27 UTC 2025 on atb-devel-224

6 weeks agopytest: samba-tool group: test with 16 character name
Douglas Bagnall [Thu, 12 Jun 2025 23:38:22 +0000 (11:38 +1200)] 
pytest: samba-tool group: test with 16 character name

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Baumbach <bb@samba.org>
6 weeks agopytest:samba-tool group: test addmembers
Douglas Bagnall [Fri, 13 Jun 2025 00:23:30 +0000 (12:23 +1200)] 
pytest:samba-tool group: test addmembers

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Baumbach <bb@samba.org>
6 weeks agolibsmbclient: Intercept "smb311_posix.statinfo" attribute
Volker Lendecke [Tue, 10 Jun 2025 17:10:42 +0000 (19:10 +0200)] 
libsmbclient: Intercept "smb311_posix.statinfo" attribute

Directly get a "struct stat" plus a 32-bit uint32 for the dosatts

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): Mon Jun 16 16:08:20 UTC 2025 on atb-devel-224

6 weeks agolibsmbclient: Intercept "posix.attr.enabled" for fgetxattr
Volker Lendecke [Mon, 2 Jun 2025 13:24:04 +0000 (15:24 +0200)] 
libsmbclient: Intercept "posix.attr.enabled" for fgetxattr

Local call to find out whether the file was opened with smb311 posix
extensions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agolibsmbclient: Request posix file handles on demand
Volker Lendecke [Wed, 4 Jun 2025 06:19:56 +0000 (08:19 +0200)] 
libsmbclient: Request posix file handles on demand

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agolibsmbclient: Allow O_PATH for smbc_open()
Volker Lendecke [Tue, 29 Apr 2025 12:04:26 +0000 (14:04 +0200)] 
libsmbclient: Allow O_PATH for smbc_open()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agolibsmbclient: Add fgetxattr
Volker Lendecke [Wed, 11 Jun 2025 10:28:09 +0000 (12:28 +0200)] 
libsmbclient: Add fgetxattr

Just boilerplate so far

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agolibsmb: Remove "source3/libsmb/libsmb.h"
Volker Lendecke [Tue, 13 May 2025 14:25:07 +0000 (16:25 +0200)] 
libsmb: Remove "source3/libsmb/libsmb.h"

libsmb.h added ads_status.h and cli_smb2_fnum.h. Only few users need
either.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 weeks agosmbd: Modernize DBGs
Volker Lendecke [Mon, 31 Mar 2025 08:27:13 +0000 (10:27 +0200)] 
smbd: Modernize DBGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Jun 14 09:49:16 UTC 2025 on atb-devel-224

6 weeks agosmbd: Avoid a ZERO_STRUCT with an explicit initialization
Volker Lendecke [Mon, 24 Feb 2025 20:04:32 +0000 (21:04 +0100)] 
smbd: Avoid a ZERO_STRUCT with an explicit initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agosmbd: Fix CID 1508939 Use of 32-bit time_t
Volker Lendecke [Wed, 2 Apr 2025 10:30:25 +0000 (12:30 +0200)] 
smbd: Fix CID 1508939 Use of 32-bit time_t

This will pop up somewhere else, but this one was easy to fix.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agorpc_server: Remove a leftover from before str_list_add_printf()
Volker Lendecke [Sun, 23 Mar 2025 16:57:37 +0000 (17:57 +0100)] 
rpc_server: Remove a leftover from before str_list_add_printf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agosmbd: Make safe_symlink_target_path() static
Volker Lendecke [Sun, 30 Mar 2025 18:28:11 +0000 (20:28 +0200)] 
smbd: Make safe_symlink_target_path() static

Only used once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agolibrpc: Fix whitespace
Volker Lendecke [Sun, 23 Mar 2025 16:03:16 +0000 (17:03 +0100)] 
librpc: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agolibcli: Avoid a ZERO_STRUCT with a direct initialization
Volker Lendecke [Tue, 10 Jun 2025 07:55:58 +0000 (09:55 +0200)] 
libcli: Avoid a ZERO_STRUCT with a direct initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agonet: Fix a panic in "net vfs getntacl"
Volker Lendecke [Thu, 20 Mar 2025 16:57:11 +0000 (17:57 +0100)] 
net: Fix a panic in "net vfs getntacl"

We have to explicitly free smb_fname, because after openat_pathref_fsp
we have a file descriptor around. If we then later talloc_free() the
connection_struct, fd_handle_destructor() panics because talloc_free()
does not free smb_fname before the connection_struct.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agolibndr: Simplify indentation in ndr_print
Volker Lendecke [Sat, 7 Jun 2025 09:34:18 +0000 (11:34 +0200)] 
libndr: Simplify indentation in ndr_print

printf can take care of the for-loop

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agolib: Use metadata_fsp() where appropriate
Volker Lendecke [Sat, 7 Jun 2025 08:54:56 +0000 (10:54 +0200)] 
lib: Use metadata_fsp() where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agosmbd: Fix whitespace
Volker Lendecke [Sat, 7 Jun 2025 09:05:55 +0000 (11:05 +0200)] 
smbd: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agos3:auth: Fix Coverity ID 1646934: memory leak in make_pw_chat
Shachar Sharon [Wed, 11 Jun 2025 12:04:31 +0000 (15:04 +0300)] 
s3:auth: Fix Coverity ID 1646934: memory leak in make_pw_chat

make_pw_chat may succeed in the first call to SMB_CALLOC_ARRAY but fail
in one of the following loop iterations, in which the list is already
populated with dynamically allocated entries. Make sure that we free the
list before bailing out with NULL.

Fixes Coverity issue 1646934

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 14 07:41:48 UTC 2025 on atb-devel-224

6 weeks agolib: Refactor fgets usage, fix resource leaks
Shwetha K Acharya [Tue, 20 May 2025 07:59:59 +0000 (13:29 +0530)] 
lib: Refactor fgets usage, fix resource leaks

This commit refactors the code by replacing fgets with
getline for more reliable line reading.

Additionally this PR,
- Corrects the error message for calloc failure.
- Ensures that resources are properly freed and
  closed before calling errx(), fixing potential
  resource leaks.
- Adds a check to gracefully skip newlines and
  comment lines(starting with #)
- simplifies error handling by grouping repetitive
  free statements under goto block

Signed-off-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 13 16:46:33 UTC 2025 on atb-devel-224

6 weeks agosmbd: Fix Coverity ID 1648344: print work-dir properly
Shachar Sharon [Tue, 3 Jun 2025 08:31:20 +0000 (11:31 +0300)] 
smbd: Fix Coverity ID 1648344: print work-dir properly

Commit 509081e7e ("smbd: expand logging in contend_dirleases()") added a
log-trace which calls get_current_dir_name() on-the-fly, which caused a
Coverity issue (memory-leak). Replace this call with the proper call to
SMB_VFS_GETWD (+ release memory).

Fixes Coverity issue 1648344

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 13 09:55:09 UTC 2025 on atb-devel-224

7 weeks agosmbd: Fix coverity#1646864 Move variable init code in checked block
Vinit Agnihotri [Thu, 12 Jun 2025 10:30:26 +0000 (16:00 +0530)] 
smbd: Fix coverity#1646864 Move variable init code in checked block

xconn was getting dereference outside NULL check block, causing
'Dereference after null check' issue.

Fix moves offeding initialisation in NULL check blog.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Jun 12 16:49:02 UTC 2025 on atb-devel-224

7 weeks agothird_party: Update waf to version 2.1.6
Andreas Schneider [Thu, 12 Jun 2025 07:11:56 +0000 (09:11 +0200)] 
third_party: Update waf to version 2.1.6

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 Jun 12 13:39:03 UTC 2025 on atb-devel-224

7 weeks agosmbd: Fix Coverity ID 1635770: avoid NULL deref of reparse
Shachar Sharon [Thu, 5 Jun 2025 08:45:00 +0000 (11:45 +0300)] 
smbd: Fix Coverity ID 1635770: avoid NULL deref of reparse

Commit 6d71edab5a ("smbd: use fsctl_get_reparse_point() in
smb3_file_posix_information_init()") introduced the local helper
function reparse_buffer_parse_posix_type; when this function enter the
case where 'reparse_tag != IO_REPARSE_TAG_NFS' the local variable
reparse is still NULL, and must not be de-referenced in DBG_INFO print.

Fixes Coverity issue 1635770

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Jun  9 06:26:05 UTC 2025 on atb-devel-224

7 weeks agosmbd: return EACCESS when Durable Handle is reconnected with different user
Ralph Boehme [Fri, 8 Nov 2024 07:38:05 +0000 (08:38 +0100)] 
smbd: return EACCESS when Durable Handle is reconnected with different user

MS-SMB2 3.3.5.9.7 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context

10.  If the user represented by Session.SecurityContext is not the same user
denoted by Open.DurableOwner, the server MUST fail the request with
STATUS_ACCESS_DENIED and proceed as specified in "Failed Open Handling"

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

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): Fri Jun  6 17:15:45 UTC 2025 on atb-devel-224

7 weeks agosmbtorture: DH reconnect with different user must fail with NT_STATUS_ACCESS_DENIED
Ralph Boehme [Fri, 8 Nov 2024 10:25:21 +0000 (11:25 +0100)] 
smbtorture: DH reconnect with different user must fail with NT_STATUS_ACCESS_DENIED

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 weeks agos3/scavenger: call smbXsrv_open_cleanup() before share_mode_cleanup_disconnected()
Ralph Boehme [Mon, 25 Mar 2024 14:53:15 +0000 (15:53 +0100)] 
s3/scavenger: call smbXsrv_open_cleanup() before share_mode_cleanup_disconnected()

This ensures smbXsrv_open_cleanup(), which checks durable_timeout_msec, will detect
a repeated DH disconnect that has reset the durable_timeout_msec.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbtorture: add test smb2.durable-v2-open.reconnect-twice
Ralph Boehme [Mon, 25 Mar 2024 15:01:55 +0000 (16:01 +0100)] 
smbtorture: add test smb2.durable-v2-open.reconnect-twice

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbd: DH reconnect hardening
Ralph Boehme [Tue, 19 Nov 2024 16:45:35 +0000 (17:45 +0100)] 
smbd: DH reconnect hardening

Verify the smbXsrv_open_global0 is marked as disconnected. This is similarily
checked in SMB_VFS_RECONNECT() for the share_mode_entry and that catches the
problem most of the times. But to be consistent we need this check also in
smb2srv_open_recreate_fn().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbd: compare Open.ClientGuid against Client.ClientGuid in DH reconnect
Ralph Boehme [Wed, 26 Feb 2025 14:28:53 +0000 (15:28 +0100)] 
smbd: compare Open.ClientGuid against Client.ClientGuid in DH reconnect

This implements the check from MS-SMB2 3.3.5.9.7 "Handling the
SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbd: only call scavenger_schedule_disconnected() if smbXsrv_open_close() succeeded
Ralph Boehme [Tue, 19 Nov 2024 19:00:49 +0000 (20:00 +0100)] 
smbd: only call scavenger_schedule_disconnected() if smbXsrv_open_close() succeeded

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbd: free smbXsrv_open if SMB_VFS_DURABLE_RECONNECT() failed
Ralph Boehme [Wed, 26 Feb 2025 15:29:18 +0000 (16:29 +0100)] 
smbd: free smbXsrv_open if SMB_VFS_DURABLE_RECONNECT() failed

Otherwise we leave "op" around which ultimately leads to smbXsrv_open_close()
being called from its destructor smbXsrv_open_destructor() that is triggerd by
its tree disconnect (or logoff, or ...) and this would clobber the open record.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbtorture: add a DH reconnect test that demonstrates the open record clobbering...
Ralph Boehme [Mon, 18 Nov 2024 17:16:59 +0000 (18:16 +0100)] 
smbtorture: add a DH reconnect test that demonstrates the open record clobbering problem

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agos3/scavenger: raise debug level to 1 for cleanup failures
Ralph Boehme [Fri, 6 Jun 2025 13:45:43 +0000 (15:45 +0200)] 
s3/scavenger: raise debug level to 1 for cleanup failures

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agos3/scavenger: support more then one Durable Handle per file
Ralph Boehme [Thu, 7 Nov 2024 14:41:18 +0000 (15:41 +0100)] 
s3/scavenger: support more then one Durable Handle per file

Best viewed with git show --patience.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 weeks agosmbd: NDR_PRINT_DEBUG the vfs_default_durable_cookie in all relevant places
Ralph Boehme [Fri, 6 Jun 2025 15:01:22 +0000 (17:01 +0200)] 
smbd: NDR_PRINT_DEBUG the vfs_default_durable_cookie in all relevant places

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 weeks agothird_party/waf: Explicit standard GNU directory command line options are not honoured
Waf Project [Wed, 28 May 2025 23:31:21 +0000 (07:31 +0800)] 
third_party/waf: Explicit standard GNU directory command line options are not honoured

ref: https://gitlab.com/ita1024/waf/-/issues/2470

(cherry picked from commit aeec9358394f883f63b3ad78c2857117ca2cdfb4)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Jun  6 10:53:07 UTC 2025 on atb-devel-224

8 weeks agodocs:man: document samba-tool dns add --allow-existing
Douglas Bagnall [Wed, 4 Jun 2025 22:51:03 +0000 (10:51 +1200)] 
docs:man: document samba-tool dns add --allow-existing

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Jun  6 00:07:43 UTC 2025 on atb-devel-224

8 weeks agosamba_dnsupdate: samba-tool add avoids existing record error messages
Douglas Bagnall [Wed, 4 Jun 2025 02:59:02 +0000 (14:59 +1200)] 
samba_dnsupdate: samba-tool add avoids existing record error messages

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agosamba_dnsupdate: slightly clarify handling of args
Douglas Bagnall [Thu, 29 May 2025 23:31:24 +0000 (11:31 +1200)] 
samba_dnsupdate: slightly clarify handling of args

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agosamba-tool dns: add --allow-existing to not complain if records exist
Douglas Bagnall [Wed, 4 Jun 2025 03:43:40 +0000 (15:43 +1200)] 
samba-tool dns: add --allow-existing to not complain if records exist

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agosamba-tool tests: test dns --allow-existing
Douglas Bagnall [Wed, 4 Jun 2025 01:23:36 +0000 (13:23 +1200)] 
samba-tool tests: test dns --allow-existing

This will fail until the next commit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agotests/samba-tool: optionally allow exception to be a failure in .run*()
Douglas Bagnall [Wed, 4 Jun 2025 01:53:32 +0000 (13:53 +1200)] 
tests/samba-tool: optionally allow exception to be a failure in .run*()

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agopytests: samba_dnsupdate --use-samba-tool versus existing records
Douglas Bagnall [Thu, 29 May 2025 23:27:30 +0000 (11:27 +1200)] 
pytests: samba_dnsupdate --use-samba-tool versus existing records

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agos3:posix_acls: avoid unnecessary level 0 debug
Douglas Bagnall [Fri, 23 May 2025 04:05:49 +0000 (04:05 +0000)] 
s3:posix_acls: avoid unnecessary level 0 debug

With 84cca757397dba107fde479bc2043d8412713cf7 (2001) we decided not to
fail if no security info was set, but we didn't remove the alarming
message.  Here we hide the message under log level 3.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agos4:prefork: raise debug level of normal exits
Douglas Bagnall [Fri, 23 May 2025 03:57:09 +0000 (03:57 +0000)] 
s4:prefork: raise debug level of normal exits

REF: https://lists.samba.org/archive/samba/2025-February/250946.html

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agos4:prefork: mention service name in exit messages
Douglas Bagnall [Fri, 23 May 2025 03:55:57 +0000 (15:55 +1200)] 
s4:prefork: mention service name in exit messages

REF: https://lists.samba.org/archive/samba/2025-February/250946.html

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agos3:smb2: debug mentions function name fewer times
Douglas Bagnall [Thu, 22 May 2025 22:34:14 +0000 (10:34 +1200)] 
s3:smb2: debug mentions function name fewer times

There was a complaint about messages like this

../../source3/smbd/smb2_server.c:4058(smbd_smb2_request_error_ex)
smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1]
status[NT_STATUS_OBJECT_NAME_NOT_FOUND] || at
../../source3/smbd/smb2_create.c:360

which weren't informing the admin know what was really
wrong. This patch doesn't help, but it does avoid
saying "smbd_smb2_request_error_ex" three times.

REF: https://lists.samba.org/archive/samba/2025-February/250967.html

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
8 weeks agothird_party/heimdal: Import lorikeet-heimdal-202505280044 (commit 1be8ce37d618704abd8...
Jennifer Sutton [Wed, 28 May 2025 00:52:26 +0000 (12:52 +1200)] 
third_party/heimdal: Import lorikeet-heimdal-202505280044 (commit 1be8ce37d618704abd82a2aa06058fa96845ad41)

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

Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Jun  3 22:52:34 UTC 2025 on atb-devel-224

8 weeks agos4:kdc: Fix memory leak of padata_value
Ivan Korytov [Fri, 21 Feb 2025 11:22:41 +0000 (14:22 +0300)] 
s4:kdc: Fix memory leak of padata_value

md.padata_value is not needed even if no error occurred.
kdc_request_add_encrypted_padata copies data from it to newly allocated r->ek.encrypted_pa_data.

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

Signed-off-by: Ivan Korytov <korytovip@basealt.ru>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
8 weeks agos4:kdc: Fix ticket encryption types memory leak
Ivan Korytov [Fri, 21 Feb 2025 10:57:10 +0000 (13:57 +0300)] 
s4:kdc: Fix ticket encryption types memory leak

sdb_entry_free was not releasing memory for s->etypes->val.

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

Signed-off-by: Ivan Korytov <korytovip@basealt.ru>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
8 weeks agos4:kdc: Fix memory leak for unused keys in TGT
Ivan Korytov [Fri, 21 Feb 2025 07:02:48 +0000 (10:02 +0300)] 
s4:kdc: Fix memory leak for unused keys in TGT

Length of key list was reduced to one but unused keys were not deallocated before changing the length.
As such, free_sdb_entry/sdb_keys_free function could not release unused keys indexed from 1 onwards on entry deallocation.

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

Signed-off-by: Ivan Korytov <korytovip@basealt.ru>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
8 weeks agolib/torture: directly remove the dummy signal event again to avoid flapping tests
Stefan Metzmacher [Wed, 28 May 2025 20:13:55 +0000 (22:13 +0200)] 
lib/torture: directly remove the dummy signal event again to avoid flapping tests

I don't know why but commit 57a57a189bd9a7348656990b2c888a328b524bb0:

 lib/torture: assert that a test doesn't create new talloc children of context->ev

introduced the regression thad lead to commit 3fa94d9f2fcb165d435c62badde9e3c8569ff40d:

 selftest: mark samba4.rpc.samr.passwords.lockout on ncacn_np with .samr.lockout as flapping

Doing a TALLOC_FREE(dummy_se) still means we have the
tevent_add_fd() from tevent_common_wakeup_init() cached as
talloc child of tevent_context and that is all we need here
and the test is not flagging anymore.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun  2 19:13:27 UTC 2025 on atb-devel-224

8 weeks agosmbd: Simplify inotify_handler()
Volker Lendecke [Wed, 28 May 2025 10:15:01 +0000 (12:15 +0200)] 
smbd: Simplify inotify_handler()

Now that we don't have to calculate "e2" anymore, we can simplify the
loop walking the buffer.

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>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jun  2 18:10:20 UTC 2025 on atb-devel-224

8 weeks agosmbd: Simplify inotify_dispatch()
Volker Lendecke [Tue, 27 May 2025 15:12:05 +0000 (17:12 +0200)] 
smbd: Simplify inotify_dispatch()

inotify_dispatch() does not need the additional arguments anymore

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>
8 weeks agosmbd: Handle what mkdir_internals() puts on inotify
Volker Lendecke [Tue, 27 May 2025 12:29:55 +0000 (14:29 +0200)] 
smbd: Handle what mkdir_internals() puts on inotify

Properly handle the TMPNAME events

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>
8 weeks agosmbd: Handle split MOVED_FROM/MOVED_TO inotify events
Volker Lendecke [Tue, 27 May 2025 11:46:30 +0000 (13:46 +0200)] 
smbd: Handle split MOVED_FROM/MOVED_TO inotify events

inotify(7) explicitly states that MOVED_FROM and MOVED_TO are not
atomically added to the inotify queue. Save MOVED_FROM in the watch
descriptor and try to match a later MOVED_TO with that. If no
corresponding MOVED_TO comes, send out a NOTIFY_ACTION_REMOVED after
100 milliseconds.

This is all racy, as we only catch directly corresponding FROM and TO
events. According to inotify(7) anything can come in between FROM and
TO, in particular other FROM/TO pairs. The best we can do I think is
turn dislocated FROM/TO pairs as REMOVED/ADDED instead of the original
Windows rename OLD_NAME/NEW_NAME.

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>
8 weeks agosmbd: Simplify inotify_handler()
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>
8 weeks agosmbd: Modernize a DEBUG
Volker Lendecke [Mon, 26 May 2025 10:54:45 +0000 (12:54 +0200)] 
smbd: Modernize a DEBUG

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>
8 weeks agosmbd: Initialize all members of struct inotify_watch_context
Volker Lendecke [Mon, 26 May 2025 09:53:31 +0000 (11:53 +0200)] 
smbd: Initialize all members of struct inotify_watch_context

We don't have talloc_zero()

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>
8 weeks agosmbd: Fix a typo
Volker Lendecke [Wed, 28 May 2025 10:32:29 +0000 (12:32 +0200)] 
smbd: Fix a typo

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>
8 weeks agosmbd: Fix some whitespace
Volker Lendecke [Fri, 23 May 2025 12:50:15 +0000 (14:50 +0200)] 
smbd: Fix some whitespace

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>
8 weeks agoCVE-2025-0620: smbd: smbd doesn't pick up group membership changes when re-authentica...
Ralph Boehme [Fri, 23 May 2025 06:47:06 +0000 (08:47 +0200)] 
CVE-2025-0620: smbd: smbd doesn't pick up group membership changes when re-authenticating an expired SMB session

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

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

2 months agoctdb-daemon: Modernise some DEBUGs
Martin Schwenke [Mon, 19 May 2025 00:06:21 +0000 (10:06 +1000)] 
ctdb-daemon: Modernise some DEBUGs

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

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

2 months agoctdb-daemon: Add configuration option shutdown extra timeout
Martin Schwenke [Sun, 18 May 2025 23:06:38 +0000 (09:06 +1000)] 
ctdb-daemon: Add configuration option shutdown extra timeout

See documentation change for details.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 months agoctdb-daemon: Run "startipreallocate" event in SHUTDOWN runstate
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.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 months agoctdb-daemon: Add configuration option shutdown failover timeout
Martin Schwenke [Mon, 12 May 2025 02:00:28 +0000 (12:00 +1000)] 
ctdb-daemon: Add configuration option shutdown failover timeout

Allows the timeout for failover during shutdown to be modified.
Defaults to 10s.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
SQ

Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 months agoctdb-daemon: Add failover on shutdown
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.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 months agoctdb-protocol: Add CTDB server SRVID range
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.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 months agoctdb-daemon: Avoid aborting during early shutdown
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:

  ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh

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:

  ./tests/local_daemons.sh foo start 0; ./tests/local_daemons.sh foo stop 0

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.

This workaround appears to be sufficient.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 months agoheimdal build clang 20: compile lex generated code
Gary Lockyer [Tue, 20 May 2025 21:21:17 +0000 (09:21 +1200)] 
heimdal build clang 20: compile lex generated code

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

2 months agoheimdal build: pass c flags in HEIMDAL_BINARY
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>
2 months agoFix clang 20 format-nonliteral warnings
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>
2 months agoFix clang 20 format-truncation warnings
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>
2 months agoFix clang 20 unused-function warnings
Gary Lockyer [Mon, 19 May 2025 04:32:22 +0000 (16:32 +1200)] 
Fix clang 20 unused-function warnings

Remove unused function:
  static inline struct ldb_val talloc_steal_ldb_val(TALLOC_CTX *mem_ctx, struct ldb_val val)
From source4/kdc/ad_claims.c
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>
2 months agoFix clang 20 unused-but-set-variables warnings
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>
2 months agoFix clang 20 sometimes-uninitialized warnings
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>
2 months agonsswitch wbinfo: fix uninitialised return value on error
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>
2 months agoFix clang 20 shadows variable in global scope warning
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>
2 months agobuild: Allow developer builds with clang 20
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>
2 months agosmbd: use fsp->name_hash in check_parent_access_fsp()
Ralph Boehme [Sat, 24 May 2025 09:47:37 +0000 (11:47 +0200)] 
smbd: use fsp->name_hash in check_parent_access_fsp()

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

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