]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
12 days agosmbd: consistently assert regular files for Durable Handles
Ralph Boehme [Wed, 3 Jun 2026 13:24:36 +0000 (15:24 +0200)] 
smbd: consistently assert regular files for Durable Handles

We already check this this way when reconnecting a handle.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agosmbd: make grant_new_fsp_lease() public and add bump_epoch
Ralph Boehme [Tue, 30 Sep 2025 15:12:49 +0000 (17:12 +0200)] 
smbd: make grant_new_fsp_lease() public and add bump_epoch

Current caller passed true which results in unchanged behaviour. However, we
will call this from durable.c when reconnecting Persistent Handle where we need
control over the exact lease version.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agovfs: add lease arg to SMB_VFS_DURABLE_RECONNECT()
Ralph Boehme [Tue, 23 Sep 2025 09:33:43 +0000 (11:33 +0200)] 
vfs: add lease arg to SMB_VFS_DURABLE_RECONNECT()

This is needed with Persistent Handles to properly deal with reestablishing
leases associated with a Persistend Handle.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agodocs-xml: add "persistent handles" and "continuous availability" options
Ralph Boehme [Sun, 11 Feb 2018 08:12:16 +0000 (09:12 +0100)] 
docs-xml: add "persistent handles" and "continuous availability" options

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/librpc: open_files.idl: updates for Persistent Handles
Ralph Boehme [Tue, 7 Oct 2025 16:39:33 +0000 (18:39 +0200)] 
s3/librpc: open_files.idl: updates for Persistent Handles

New share_mode_entry flag:
- SHARE_ENTRY_FLAG_PERSISTENT_OPEN

New share_mode_data member:
- num_persistent

New share_mode_entry members:
- create_guid
- protect

delete_token
- open_persistent_id

New vfs_default_durable_cookie members:
- initial_delete_on_close

The SHARE_ENTRY_FLAG_PERSISTENT_OPEN flag is crucially needed to modify the
behaviour of share_entry_stale_pid() and used in other places when looking at a
share_mode_entry and having to adust processing behaviour for Persistent
Handles.

num_persistent is used to track the number of Persistent Handles per
share_mode_data record, adjusting dbwrap_store() behaviour depending on its
value: if num_persistent is greater then zero, we pass DBWRAP_STORE_PERSISTENT.
Without it we would have to iterate over oll share_mode_entry's every time we
store the record.

The create_guid ties together the open state from locking.tdb and the
smbXsrv_open_global.tdb as an additional hardening to securely corolate both.

The protect boolean is an in-memory flag indicating a disconnected Persistent
Handle. We don't want to store this in the share_mode_entry on disk.

open_persistent_id in the delete_token will be used to implement scavening
delete_tokens when Persistent Handles with delete-on-close set expire. Windows
will actually delete the file, but this is not easily possible with the current
architecture of the scavenger, but we must at least correctly remove those stale
tokens.

initial_delete_on_close is used to preserve the fsp flag initial_delete_on_close
across disconnects. When reconnecting the handle, the fsp flag can be
reestablished based on the value from the cookie.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/librpc: smbXsrv.idl: add and fill tcon->smb_max_lease_mask
Ralph Boehme [Fri, 28 Nov 2025 09:57:43 +0000 (10:57 +0100)] 
s3/librpc: smbXsrv.idl: add and fill tcon->smb_max_lease_mask

This adds the following paremetric options

smb1:max lease mask = RWH (default:RWH)
smb2:max lease mask = RWH (default:RWH)

For now keep them as "internal" undocumented parametric options. If we learn
about real world usecases in the future, we can then look into turning them into
documented options.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/librpc: smbXsrv.idl: store share_type, share_flags and capabilities in struct...
Ralph Boehme [Tue, 18 Mar 2025 10:31:45 +0000 (11:31 +0100)] 
s3/librpc: smbXsrv.idl: store share_type, share_flags and capabilities in struct smbXsrv_tcon

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/librpc: smbXsrv.idl: updates for Persistent Handles
Ralph Boehme [Fri, 28 Jul 2017 14:48:25 +0000 (16:48 +0200)] 
s3/librpc: smbXsrv.idl: updates for Persistent Handles

Changes in smbXsrv_open_global0:
- persistent
- file_id
- name_hash
- app_instance_vhigh
- app_instance_vlow

The persistent flag is the primary means of directing all FSA and SMB layer
behaviour for Persistent Handles.

The file_id is used when scanning the smbXsrv_open_global.tdb for stale opens
and scheduling cleanup via the scavenger: scavenger uses the file-id from the
open to fetch the file record from locking.tdb.

name_hash will be used as part of implementing delete-on-close token cleanup via
the scavenger.

app_instance_vhigh and app_instance_vlow are part of the app_instance_id related
feature.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agolibcli/smb: move smb2_util_lease_state() to libcli/smb/util.c
Ralph Boehme [Fri, 28 Nov 2025 09:57:23 +0000 (10:57 +0100)] 
libcli/smb: move smb2_util_lease_state() to libcli/smb/util.c

While at it, get rid of the strlen(), we don't need it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agolibrpc/idl: build Python bindings for struct file_id
Ralph Boehme [Mon, 25 Aug 2025 14:39:42 +0000 (16:39 +0200)] 
librpc/idl: build Python bindings for struct file_id

Soon adding struct file_id to smbXsrv.idl, so
examples/scripts/debugging/smbXsrvdump will need this.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/locking: add versioning support to brlock.tdb
Ralph Boehme [Thu, 17 Jul 2025 10:51:35 +0000 (12:51 +0200)] 
s3/locking: add versioning support to brlock.tdb

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/locking: add versioning support to locking.tdb
Ralph Boehme [Tue, 15 Jul 2025 14:58:50 +0000 (16:58 +0200)] 
s3/locking: add versioning support to locking.tdb

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/librpc: smbXsrv.idl: make smbXsrv_version_values public
Ralph Boehme [Sun, 30 Nov 2025 12:07:46 +0000 (13:07 +0100)] 
s3/librpc: smbXsrv.idl: make smbXsrv_version_values public

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3/locking: use smbXsrv_version_global_init() in locking_init()
Ralph Boehme [Sat, 23 Aug 2025 09:52:11 +0000 (11:52 +0200)] 
s3/locking: use smbXsrv_version_global_init() in locking_init()

This is only needed when opening in read-write mode in order to initialize
smbXsrv_version_global_current() which is used to set the record version when
storing a record.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agos3:torture: add LOCAL-DBWRAP-PER-REC-PERSISTENCY test
Ralph Boehme [Sun, 30 Nov 2025 11:01:37 +0000 (12:01 +0100)] 
s3:torture: add LOCAL-DBWRAP-PER-REC-PERSISTENCY test

This adds a bunch of simple test for the newdbwrap per-record persistency API.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agog_lock: maintain and use record flag
Ralph Boehme [Wed, 19 Mar 2025 05:24:52 +0000 (06:24 +0100)] 
g_lock: maintain and use record flag

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agog_lock: add flags to g_lock_lock_cb_writev() and g_lock_writev_data()
Ralph Boehme [Mon, 16 Dec 2024 16:32:35 +0000 (17:32 +0100)] 
g_lock: add flags to g_lock_lock_cb_writev() and g_lock_writev_data()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_watch: maintain and use record flags
Ralph Boehme [Wed, 19 Mar 2025 04:59:09 +0000 (05:59 +0100)] 
dbwrap_watch: maintain and use record flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_watch: implement dbwrap_wipe() in the dbwrap_watch backend
Ralph Boehme [Fri, 24 Oct 2025 15:19:31 +0000 (17:19 +0200)] 
dbwrap_watch: implement dbwrap_wipe() in the dbwrap_watch backend

Simply calls dbwrap_wipe() on the backend.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_watch: implement traverse_per_rec_persistent_read()
Ralph Boehme [Sun, 6 May 2018 13:37:24 +0000 (15:37 +0200)] 
dbwrap_watch: implement traverse_per_rec_persistent_read()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_ctdb: implement per-record persistency
Ralph Boehme [Sun, 23 Nov 2025 13:03:01 +0000 (14:03 +0100)] 
dbwrap_ctdb: implement per-record persistency

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_ctdb: pass record data to db_ctdb_can_use_local_hdr()
Ralph Boehme [Sun, 23 Nov 2025 13:07:37 +0000 (14:07 +0100)] 
dbwrap_ctdb: pass record data to db_ctdb_can_use_local_hdr()

Not yet used. Prepares for modifying the data based on flags in the header.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_ctdb: restructure db_ctdb_parse_record_parser_nonpersistent()
Ralph Boehme [Sun, 23 Nov 2025 12:58:05 +0000 (13:58 +0100)] 
dbwrap_ctdb: restructure db_ctdb_parse_record_parser_nonpersistent()

Reverse if/else logic, return from if branch which avoids the else branch. No
change in behaviour. Prepares for adding more logic later.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_ctdb: factor out db_ctdb_migrate_locked() from fetch_locked_internal()
Ralph Boehme [Sun, 23 Nov 2025 10:56:10 +0000 (11:56 +0100)] 
dbwrap_ctdb: factor out db_ctdb_migrate_locked() from fetch_locked_internal()

No change in behaviour. Prepares for more callers of db_ctdb_migrate_locked().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_ctdb: if a txn commit fails in a recovery, do an exponential backoff when...
Ralph Boehme [Sun, 23 Nov 2025 10:38:19 +0000 (11:38 +0100)] 
dbwrap_ctdb: if a txn commit fails in a recovery, do an exponential backoff when retrying

Prevents flooding the ctdbd log with message like "invalid txn commit during recovery".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_ctdb: use CTDB_FETCH_WITH_HEADER_FUNC in ctdbd_parse[_send]()
Ralph Boehme [Sun, 23 Nov 2025 10:30:51 +0000 (11:30 +0100)] 
dbwrap_ctdb: use CTDB_FETCH_WITH_HEADER_FUNC in ctdbd_parse[_send]()

Use db_ctdb_parse_record_parser_nonpersistent() to check if the header is
usable. Prepares for doing additional checks in
db_ctdb_parse_record_parser_nonpersistent().

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agoctdbd_conn: add ctdbd_generation()
Ralph Boehme [Thu, 18 Dec 2025 11:32:36 +0000 (12:32 +0100)] 
ctdbd_conn: add ctdbd_generation()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap_tdb: implement per-record persistency support
Ralph Boehme [Thu, 18 Dec 2025 14:51:04 +0000 (15:51 +0100)] 
dbwrap_tdb: implement per-record persistency support

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add dbwrap_log_key()
Ralph Boehme [Mon, 15 Dec 2025 15:55:45 +0000 (16:55 +0100)] 
dbwrap: add dbwrap_log_key()

While at it, add the missing prefix to the debug message if the keysize is
larger then 1023 bytes.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add dbwrap_record_get_flags()
Ralph Boehme [Wed, 19 Mar 2025 04:57:42 +0000 (05:57 +0100)] 
dbwrap: add dbwrap_record_get_flags()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add define for migration marker key string
Ralph Boehme [Wed, 19 Mar 2025 10:44:48 +0000 (11:44 +0100)] 
dbwrap: add define for migration marker key string

This will be shared between dbwrap_tdb and dbwrap_ctdb.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add dbwrap_traverse_per_rec_persistent_read()
Ralph Boehme [Wed, 2 May 2018 09:20:02 +0000 (11:20 +0200)] 
dbwrap: add dbwrap_traverse_per_rec_persistent_read()

Will be used much later in the commit series by cleanupd to list the per-record
persistent backup records of the smbXsrv_open_gobal.tdb to trigger open record
scavenging.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add flags DBWRAP_STORE_PERSISTENT
Ralph Boehme [Wed, 11 Apr 2018 15:22:51 +0000 (17:22 +0200)] 
dbwrap: add flags DBWRAP_STORE_PERSISTENT

Request storing a record with persistent semantics, the details of the
implementation are up to the backend.

Fwiw, the existing "flags" DBWRAP_[REPLACE|INSERT|MODIFY] are not flags in the
real sense, but rather something like an opcode/enum.

The new values DBWRAP_STORE_PERSISTENT will be real flags, so the backend
implementations have to be careful when processing the flags, eg if passing the
flags to TDB in the backend.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: store db_open() dbwrap flags in struct db_context
Ralph Boehme [Sat, 3 Mar 2018 21:22:25 +0000 (22:22 +0100)] 
dbwrap: store db_open() dbwrap flags in struct db_context

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add flag DBWRAP_FLAG_PER_REC_PERSISTENT
Ralph Boehme [Sat, 18 Nov 2017 13:39:59 +0000 (14:39 +0100)] 
dbwrap: add flag DBWRAP_FLAG_PER_REC_PERSISTENT

Used by callers to open with per-record persistency.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add flags to dbwrap_wipe()
Ralph Boehme [Thu, 23 Oct 2025 16:41:41 +0000 (18:41 +0200)] 
dbwrap: add flags to dbwrap_wipe()

Will be used later to pass flags=DBWRAP_DROP_PERSISTENT for databases with
DBWRAP_FLAG_PER_REC_PERSISTENT, requesting to wipe the persistent backup
database.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add record flags to struct db_record
Ralph Boehme [Mon, 4 Nov 2024 06:54:19 +0000 (07:54 +0100)] 
dbwrap: add record flags to struct db_record

This is needed to implement persistent record deletion in the case that
a record was stored as persistent, then fetched and is then stored
without persistency.

The additional tdb record header uses CTDB_REC_FLAG_PERSISTENT to denote if the
record was stored as persistent. When fetching a record we remember the
persistency property in record.flags.persistent.

When a subsequent store doesn't request persistency and record.flags.persistent
is set, we delete record from the persistent database.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: convert dbwrap_store_bystring_upper() from TDB to DBWRAP flags
Ralph Boehme [Wed, 11 Apr 2018 15:07:54 +0000 (17:07 +0200)] 
dbwrap: convert dbwrap_store_bystring_upper() from TDB to DBWRAP flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: convert dbwrap_trans_store_bystring() from TDB to DBWRAP flags
Ralph Boehme [Wed, 11 Apr 2018 15:07:54 +0000 (17:07 +0200)] 
dbwrap: convert dbwrap_trans_store_bystring() from TDB to DBWRAP flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: convert dbwrap_trans_store() from TDB to DBWRAP flags
Ralph Boehme [Wed, 11 Apr 2018 15:07:54 +0000 (17:07 +0200)] 
dbwrap: convert dbwrap_trans_store() from TDB to DBWRAP flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: convert dbwrap_store_bystring() from TDB to DBWRAP flags
Ralph Boehme [Wed, 11 Apr 2018 15:07:54 +0000 (17:07 +0200)] 
dbwrap: convert dbwrap_store_bystring() from TDB to DBWRAP flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: convert dbwrap_store() from TDB to DBWRAP flags
Ralph Boehme [Mon, 4 Nov 2024 06:53:34 +0000 (07:53 +0100)] 
dbwrap: convert dbwrap_store() from TDB to DBWRAP flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: convert dbwrap_record_store() from TDB to DBWRAP flags
Ralph Boehme [Mon, 4 Nov 2024 06:45:59 +0000 (07:45 +0100)] 
dbwrap: convert dbwrap_record_store() from TDB to DBWRAP flags

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agodbwrap: add store flags
Ralph Boehme [Wed, 11 Apr 2018 15:05:49 +0000 (17:05 +0200)] 
dbwrap: add store flags

The map directly to TDB flags. Later commits will add a flag that is
unique to dbwrap.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agoctdb-protocol: add CTDB_REC_FLAG_PERSISTENT[_IN_PROGRESS]
Ralph Boehme [Fri, 14 Nov 2025 15:21:09 +0000 (16:21 +0100)] 
ctdb-protocol: add CTDB_REC_FLAG_PERSISTENT[_IN_PROGRESS]

CTDB_REC_FLAG_PERSISTENT is set when a record was stored once with per-record
persistency semantics and has a record in the persistent backup database. It's
used by the dbwrap_ctdb backend to determine if the backup record can be deleted
when storing a record.

CTDB_REC_FLAG_PERSISTENT_IN_PROGRESS is used by dbwrap_ctdb when opening database with per-record
persistency support (DBWRAP_FLAG_PER_REC_PERSISTENT). The flag is needed to make
stores atomic without holding a TDB chainlock, similar to a "glock" in smbd
parlance and also comes with a "glock" owner payload (struct server_id) to
detect stale "glocks".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agoctdbd_conn: add ctdbd_control_broadcast()
Ralph Boehme [Tue, 4 Sep 2018 15:05:50 +0000 (17:05 +0200)] 
ctdbd_conn: add ctdbd_control_broadcast()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agoctdb: Add pushrecord command and client side code
Ralph Boehme [Tue, 3 Dec 2024 11:26:38 +0000 (12:26 +0100)] 
ctdb: Add pushrecord command and client side code

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agoctdb: add ctdb_record_set_header()
Ralph Boehme [Wed, 17 Dec 2025 18:52:10 +0000 (19:52 +0100)] 
ctdb: add ctdb_record_set_header()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
12 days agoctdb-daemon: Implement CTDB_CONTROL_PUSH_RECORD
Ralph Boehme [Tue, 3 Dec 2024 11:21:38 +0000 (12:21 +0100)] 
ctdb-daemon: Implement CTDB_CONTROL_PUSH_RECORD

Pair-Programmed-With: Martin Schwenke <martin@meltin.net>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Ralph Boehme <slow@samba.org>
12 days agoctdb-tests: Add protocol unit tests for CTDB_CONTROL_PUSH_RECORD
Martin Schwenke [Thu, 6 Nov 2025 04:25:01 +0000 (15:25 +1100)] 
ctdb-tests: Add protocol unit tests for CTDB_CONTROL_PUSH_RECORD

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
12 days agoctdb-protocol: Add CTDB_CONTROL_PUSH_RECORD
Ralph Boehme [Tue, 3 Dec 2024 11:26:38 +0000 (12:26 +0100)] 
ctdb-protocol: Add CTDB_CONTROL_PUSH_RECORD

Clients can use this control to push records to a volatile database on
all nodes at once.

Pair-Programmed-With: Martin Schwenke <martin@meltin.net>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Ralph Boehme <slow@samba.org>
12 days agoctdb: add ctdb_ltdb_sync()
Ralph Boehme [Fri, 28 Feb 2025 16:47:03 +0000 (17:47 +0100)] 
ctdb: add ctdb_ltdb_sync()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2 weeks agomdssvc: fix Spotlight queries restricted to subdirectories with NFD paths
Priyanka Soni [Thu, 4 Jun 2026 13:48:41 +0000 (19:18 +0530)] 
mdssvc: fix Spotlight queries restricted to subdirectories with NFD paths

Ensure directory scopes match by aligning Unicode normalization forms.
This fixes the case when the macOS client restricts the search to
a subdirectory. macOS clients transmit paths using NFD, which can
cause lookups to fail against NFC systems used by Samba and Elasticsearch.

This commit also includes a bug fix by Ralph Boehme <slow@samba.org> to resolve a
null-termination issue of the NFD converted path in add_filemeta().

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

Signed-off-by: Priyanka Soni <priysoni@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jul 14 14:22:46 UTC 2026 on atb-devel-224

2 weeks agolib:ldb: Fix memory leaks in ldb_kv_index.c
Petr Usoltsev [Tue, 3 Mar 2026 07:31:18 +0000 (15:31 +0800)] 
lib:ldb: Fix memory leaks in ldb_kv_index.c

The "rec" variable is allocated within the long-lived LDB memory
context, meaning it persists until the module is unloaded.
Previously, this resource was only freed upon the successful
execution of ldb_dn_compare().

If ldb_dn_compare fails, the allocated memory is leaked. This patch
ensures that the memory is properly released regardless of the
function's return status.

Signed-off-by: Petr Usoltsev <usoltsevpv@basealt.ru>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Jul 14 06:18:36 UTC 2026 on atb-devel-224

2 weeks agos3:rpc_server: Fix undefined behavior from strchr
Noel Power [Thu, 2 Jul 2026 08:45:40 +0000 (09:45 +0100)] 
s3:rpc_server: Fix undefined behavior from strchr

  o If no backslash was found in servername, variable asprinter will
    contain NULL value. It will then be passed to strchr call,
    resulting in undefined behavior.
  o Also rework code to remove const violation of handlename

Pair-Programmed-With: Dmitriy Mikhalchenko <tascad@altlinux.org>
Pair-Programmed-With: Noel Power <noel.power@suse.com>
Signed-off-by: Shishkov Nikita <shishkovna@sgu.ru>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Jul 13 16:14:50 UTC 2026 on atb-devel-224

2 weeks agos3/rpc_server/spoolss: use single exit point set_printer_hnd_name
Noel Power [Thu, 2 Jul 2026 08:18:21 +0000 (09:18 +0100)] 
s3/rpc_server/spoolss: use single exit point set_printer_hnd_name

To make error handling simpler in the future instead of mulitple
exit points (returning early) add 'out' label to 'goto' instead

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoWHATSNEW: Document that CTDB now follows Samba configure options
Martin Schwenke [Sun, 12 Jul 2026 01:41:35 +0000 (11:41 +1000)] 
WHATSNEW: Document that CTDB now follows Samba configure options

For locks, PID files and sockets.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Jul 13 13:59:00 UTC 2026 on atb-devel-224

2 weeks agoctdb-build: Drop unused CTDB_RUNDIR
Martin Schwenke [Tue, 7 Jul 2026 12:29:14 +0000 (22:29 +1000)] 
ctdb-build: Drop unused CTDB_RUNDIR

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-common: Drop unused rundir support
Martin Schwenke [Tue, 7 Jul 2026 12:25:20 +0000 (22:25 +1000)] 
ctdb-common: Drop unused rundir support

It no longer makes sense because separate lockdir, piddir, socketdir
support should be used.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-tcp: Use path_lockdir_append()
Martin Schwenke [Mon, 6 Jul 2026 11:14:23 +0000 (21:14 +1000)] 
ctdb-tcp: Use path_lockdir_append()

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb: Use CTDB_PIDDIR and CTDB_SOCKETDIR
Martin Schwenke [Mon, 6 Jul 2026 10:57:14 +0000 (20:57 +1000)] 
ctdb: Use CTDB_PIDDIR and CTDB_SOCKETDIR

These are now used in path_*() functions, the default CTDB_SOCKET
define and substitution in ctdb.service.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-common: Fix CTDB_SOCKET default outside test mode
Martin Schwenke [Mon, 6 Jul 2026 08:44:34 +0000 (18:44 +1000)] 
ctdb-common: Fix CTDB_SOCKET default outside test mode

smbd expects to use CTDB_SOCKET (define, not environment variable) as
a default.

If --with-socketpath was specified at build time then smbd and ctdbd
might disagree on the socket location.  smbd will use whatever is
specified (i.e. CTDB_SOCKET) but CTDB always uses path_socket() to put
the socket in CTDB_RUNDIR.

CTDB should default to CTDB_SOCKET (define) too.

This only changes the result when --with-socketpath is specified.  We
should get rid of that later and always use something in
CTDB_SOCKETDIR.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-common: Swap conditions for ctdbd socket and test mode
Martin Schwenke [Mon, 6 Jul 2026 08:39:59 +0000 (18:39 +1000)] 
ctdb-common: Swap conditions for ctdbd socket and test mode

This makes a subsequent commit less confusing.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-common: Add basic path functionality for new directories
Martin Schwenke [Mon, 6 Jul 2026 08:23:42 +0000 (18:23 +1000)] 
ctdb-common: Add basic path functionality for new directories

New path_*() functions for CTDB_LOCKDIR, CTDB_PIDDIR, CTDB_SOCKETDIR.

In test mode these all use "${CTDB_BASE}/run".

The new functions are not yet used, except in the ctdb-path command.

path_socket() and path_pidfile() are not modified.  If they were then
the new functions would be used.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-common: Factor out some generic functions
Martin Schwenke [Fri, 10 Jul 2026 12:21:32 +0000 (22:21 +1000)] 
ctdb-common: Factor out some generic functions

There will soon be more path_tool_*() functions, so minimise
repetition by introducing some generic functions.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-common: Apply some README.Coding to initialisation
Martin Schwenke [Fri, 10 Jul 2026 12:44:30 +0000 (22:44 +1000)] 
ctdb-common: Apply some README.Coding to initialisation

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-build: Add support for CTDB_{LOCKDIR,PIDDIR,SOCKETDIR}
Martin Schwenke [Mon, 6 Jul 2026 08:18:51 +0000 (18:18 +1000)] 
ctdb-build: Add support for CTDB_{LOCKDIR,PIDDIR,SOCKETDIR}

That is, introduce new defines:

* CTDB_LOCKDIR
* CTDB_PIDDIR
* CTDB_SOCKETDIR

The new defines are currently unused.  However, the directories are
created at installation time.

This is the first step in addressing the problem where /var/run/ctdb/
can't be separately configured to be outside LOCALSTATEDIR.
e.g. /run/ctdb/.

This has become a problem when unpacking Samba installation tarballs.
Some versions of tar (e.g. 1.35-11.el10) don't handle unpacking across
cross-filesystem symlinks (such as /var/run -> ../run) due to
extensive use of openat(2).  This could be a bug in tar, but we might
as well use this as an opportunity make CTDB's installation paths more
flexible.

The change recognises that CTDB is part of Samba, following its
build-time configuration for these items.  So, the new defines point
to ctdb/ subdirectories under Samba's LOCKDIR, PIDDIR and SOCKET_DIR,
respectively.

For the standalone build, the required variables are not available, so
add some backward compatibility.  This means that using CTDB with
Samba requires a combined build.  This is of little consequences
because the standalone build is probably only used for developer
testing.  Replacing the backward compatibility hack by plumbing
dynconfig into CTDB is an exercise for another time - I tried it and
it didn't seem straightforward.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-scripts: Admit that ctdb.init is an example
Martin Schwenke [Sun, 12 Jul 2026 22:32:39 +0000 (08:32 +1000)] 
ctdb-scripts: Admit that ctdb.init is an example

ctdb.init is basically unmaintained and untested.  It is only really
referenced by ctdb.spec.in, which is in ctdb/doc/examples/.  Move
ctdb.init there too.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-build: Clean up a few things
Martin Schwenke [Wed, 8 Jul 2026 02:12:28 +0000 (12:12 +1000)] 
ctdb-build: Clean up a few things

These lists of items should be in alphabetical order to make them
easier to browse.

The ADD_CFLAGS() one is currently 2 lists, which makes maintenance
error prone.  It could be improved with one or more f-strings allowing
the substitutions to be done inline.  However, having a dict with
items in 2 columns makes the pairing much more obvious.  Build the
result using a list comprehension whose result contains a string per
define and then join the items.

For the large sed expression, numbered variables aren't particularly
flexible.  So, once again, use a dict to hold the required
substitutions.  Build each sed command-line option as a list item
using a list comprehension and then join the items.

In both cases, I think using a dict means less visual clutter because
each line doesn't need to be enclosed in parentheses).

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agoctdb-scripts: Add host monitoring
Martin Schwenke [Wed, 1 Mar 2023 22:29:31 +0000 (09:29 +1100)] 
ctdb-scripts: Add host monitoring

It can be difficult to diagnose certain event script timeouts.  So, at
the risk of re-inventing Nagios, this provides some limited host
monitoring to ensure that nodes are able to reach configured
infrastructure.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Jul  9 17:07:12 UTC 2026 on atb-devel-224

2 weeks agoctdb-scripts: Support periodic printing of warnings
Martin Schwenke [Fri, 27 Feb 2026 07:20:21 +0000 (18:20 +1100)] 
ctdb-scripts: Support periodic printing of warnings

In the case where a failcount only produces warnings (not
errors/unhealthy), the warnings could continue forever.  A constant
stream of warnings could dominate the logs, possibly obscuring other
useful messages.

To avoid this, add interval-based printing of warnings.  It can be set
to "hourly", "daily", any number of seconds (up to 4 digits) or
"none" (no periodic warning, use current behaviour).  The default is
"hourly".

Generally, the same interval will apply to all failcounts in a script.
However, multiple carefully placed calls to
failcount_set_warning_interval() can cause different intervals to be
used for different counters.

Add an extra unit test for vsftp monitoring to test this.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-doc: Expand documentation of monitoring thresholds
Martin Schwenke [Thu, 12 Mar 2026 04:38:04 +0000 (15:38 +1100)] 
ctdb-doc: Expand documentation of monitoring thresholds

This allows the system resource monitoring documentation to be
simplified.  It also makes subsequent changes easier.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoWHATSNEW: Document CTDB network monitor and platform style changes
Martin Schwenke [Sun, 19 Apr 2026 04:22:14 +0000 (14:22 +1000)] 
WHATSNEW: Document CTDB network monitor and platform style changes

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-scripts: New variable CTDB_PLATFORM_STYLE
Martin Schwenke [Thu, 5 Mar 2026 03:37:20 +0000 (14:37 +1100)] 
ctdb-scripts: New variable CTDB_PLATFORM_STYLE

CTDB_PLATFORM_STYLE is effectively a rename of CTDB_INIT_STYLE, since
a variable is needed that will be used for more purposes than "init".

The new variable is automatically set when sourcing the functions
file.

CTDB_INIT_STYLE is now deprecated and can still be set be calling
detect_init_style().  This provides backward compatibility for
site-local scripts.

Avoid using a state file.  Given that detect_platform_style() is now
only called in 1 place (i.e. immediately after its definition), the
state file is an unnecessary optimisation.  Also, using a state file,
and setting the variable automatically when sourcing the file, means
that CTDB_SCRIPT_VARDIR needs to be overridden in more UNIT test
suites.  For example, the tools ctdb lvs/natgw unit tests indirectly test
the ctdb_lvs/ctdb_natgw scripts, which source the functions file.

The previous sub-shell wasn't useful protection against a poisoned
/etc/os-release file.  Evil commands are evil commands, so if someone
can poison that file then we're in more trouble than this script can
handle.  However, limiting to a couple of variables with the eval/grep
trick seems like a a useful idea because those variables can then be
manually unset when they are no longer needed.  Using eval to do the
parsing also means that full manual parsing does not need to be
implemented, which would require handling (optional) quotes around
values.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-scripts: Put output under the control of failure counting
Martin Schwenke [Sun, 1 Mar 2026 04:18:00 +0000 (15:18 +1100)] 
ctdb-scripts: Put output under the control of failure counting

The port checking output should be under the control of the failure
counting.  It shouldn't be printed every time.

Duplicate most of the associated test to ensure that the counter is
correctly reset.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-scripts: Improve some comments
Martin Schwenke [Wed, 1 Mar 2023 01:14:04 +0000 (12:14 +1100)] 
ctdb-scripts: Improve some comments

The word "passing" is ambiguous, since it could refer to whether a
value is passed to the function.  "exceeding" is wrong, because the
counter is equal.  Instead, use "reaching".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-scripts: Reformat with "shfmt -w -i 0 -fn"
Martin Schwenke [Sat, 28 Feb 2026 10:48:06 +0000 (21:48 +1100)] 
ctdb-scripts: Reformat with "shfmt -w -i 0 -fn"

Best reviewed with "git show -w" or similar.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Drop an unnecessary part of some messages
Martin Schwenke [Sun, 1 Mar 2026 04:46:21 +0000 (15:46 +1100)] 
ctdb-tests: Drop an unnecessary part of some messages

The whole "not managed by CTDB" thing hasn't been relevant for a
while.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Reformat with "shfmt -w -i 0 -fn"
Martin Schwenke [Sun, 1 Mar 2026 03:36:40 +0000 (14:36 +1100)] 
ctdb-tests: Reformat with "shfmt -w -i 0 -fn"

Best reviewed with "git show -w" or similar.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Call real stat from stat stub to get mtime
Martin Schwenke [Sun, 1 Mar 2026 00:01:57 +0000 (11:01 +1100)] 
ctdb-tests: Call real stat from stat stub to get mtime

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Enhance timeout stub
Martin Schwenke [Fri, 17 Mar 2023 00:05:19 +0000 (11:05 +1100)] 
ctdb-tests: Enhance timeout stub

Allow it to trigger on a particular command instead of
unconditionally.  Wrap setting and clearing the variable.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Add error handling to stat stub
Martin Schwenke [Sat, 28 Feb 2026 00:49:09 +0000 (11:49 +1100)] 
ctdb-tests: Add error handling to stat stub

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Drop an unused stat stub format
Martin Schwenke [Sat, 28 Feb 2026 00:33:51 +0000 (11:33 +1100)] 
ctdb-tests: Drop an unused stat stub format

Wondering what it was ever for (debug_locks.sh testing!) cost me
valuable time...

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-recoverd: Do not allow nested elections
Martin Schwenke [Tue, 12 May 2026 07:40:05 +0000 (17:40 +1000)] 
ctdb-recoverd: Do not allow nested elections

This appears to show nested elections:

  2026-05-12T12:15:56.130174+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout
  2026-05-12T12:15:56.130206+05:30 nsds1 ctdb-recoverd[826]: Start election
  2026-05-12T12:15:56.130329+05:30 nsds1 ctdb-recoverd[826]: Attempting to take cluster lock (!/usr/libexec/ctdb/ctdb_mutex_fcntl_helper /mnt/lustre/mac167/nsds_conf/.nsds_config/cluster_lock 5 20)
  2026-05-12T12:16:01.131882+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout
  2026-05-12T12:16:01.131918+05:30 nsds1 ctdb-recoverd[826]: Start election

There is no sign that the first election ended.  Starting another one
causes bad state interactions.  Apart from causing confusion for
multiple pieces of state (e.g. rec->election_in_progress), a nested
call to _cluster_lock_lock() will leak rec->cluster_lock_handle
because it will overwrite it with the new in-progress handle.

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

Reported-by: Agam S <sagam@ddn.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Jul  9 15:24:42 UTC 2026 on atb-devel-224

2 weeks agoctdb-recoverd: Strengthen check for cluster lock held
Martin Schwenke [Tue, 12 May 2026 07:19:03 +0000 (17:19 +1000)] 
ctdb-recoverd: Strengthen check for cluster lock held

This avoids attempting to start recovery without holding the cluster
lock.

There seems to be only one way the following can happen:

  2026-05-12T12:15:51.127992+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout
  2026-05-12T12:15:51.128019+05:30 nsds1 ctdb-recoverd[826]: Start election
  2026-05-12T12:15:51.128192+05:30 nsds1 ctdb-recoverd[826]: Attempting to take cluster lock (!/usr/libexec/ctdb/ctdb_mutex_fcntl_helper /mnt/lustre/mac167/nsds_conf/.nsds_config/cluster_lock 5 20)
  2026-05-12T12:15:51.135578+05:30 nsds1 ctdbd[700]: ctdb_mutex_fcntl_helper: Unable to open /mnt/lustre/mac167/nsds_conf/.nsds_config/cluster_lock - (No such file or directory)
  2026-05-12T12:15:51.135590+05:30 nsds1 ctdb-recoverd[826]: Unable to take cluster lock - unknown error
  2026-05-12T12:15:56.130174+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout
  2026-05-12T12:15:56.130206+05:30 nsds1 ctdb-recoverd[826]: Start election
  2026-05-12T12:15:56.130329+05:30 nsds1 ctdb-recoverd[826]: Attempting to take cluster lock (!/usr/libexec/ctdb/ctdb_mutex_fcntl_helper /mnt/lustre/mac167/nsds_conf/.nsds_config/cluster_lock 5 20)
  2026-05-12T12:16:01.131882+05:30 nsds1 ctdb-recoverd[826]: Leader broadcast timeout
  2026-05-12T12:16:01.131918+05:30 nsds1 ctdb-recoverd[826]: Start election
  2026-05-12T12:16:13.094308+05:30 nsds1 ctdbd[700]: ctdb_mutex_fcntl_helper: Unable to open /mnt/lustre/mac167/nsds_conf/.nsds_config/cluster_lock - (No such file or directory)
  2026-05-12T12:16:13.094362+05:30 nsds1 ctdb-recoverd[826]: Unable to take cluster lock - unknown error
  2026-05-12T12:16:13.094582+05:30 nsds1 ctdb-recoverd[826]: do_recovery: Starting do_recovery
  2026-05-12T12:16:13.094591+05:30 nsds1 ctdb-recoverd[826]: Cluster lock not held - abort recovery, ban node
  2026-05-12T12:16:13.094596+05:30 nsds1 ctdb-recoverd[826]: Banning node 0 for 300 seconds
  2026-05-12T12:16:13.094612+05:30 nsds1 ctdbd[700]: Banning this node for 300 seconds

_cluster_lock_lock() sets rec->cluster_lock_handle during an attempt
to take the cluster look.  This function contains a nested event loop
where other things can happen.  Presumably the 3rd leader broadcast
timeout above occurs, starting a nested election (which also needs to
be avoided - this is the real root cause).  cluster_lock_election()
then presumably finds that cluster_lock_held() returns true and sets
the leader to the current node.

However, the check in cluster_lock_held() is too weak and the "locked"
element must also be checked.  As noted above, the nested elections
are the real issue but this is a belts-and-braces fix that should be
in place to avoid weirdness due to the nested event loop.

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

Reported-by: Agam S <sagam@ddn.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agovfs_default: tidy persvc profile macros usage
Shachar Sharon [Sun, 5 Jul 2026 08:51:00 +0000 (11:51 +0300)] 
vfs_default: tidy persvc profile macros usage

Close async write with proper SMBPROFILE_BYTES_ASYNC_END_X macro to
properly update both global and per-share counter. Use smbprofile
pervsc helper macros when possible.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Jul  9 07:01:43 UTC 2026 on atb-devel-224

2 weeks agoprofile: avoid duplicate logic in get/lookup
Shachar Sharon [Mon, 6 Jul 2026 13:11:45 +0000 (16:11 +0300)] 
profile: avoid duplicate logic in get/lookup

Do not duplicate the 'smbprofile_active()' and 'snum < 0' logic in two
places; use it only in lookup local helper.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2 weeks agoprofile: align macros args
Shachar Sharon [Sun, 5 Jul 2026 09:12:57 +0000 (12:12 +0300)] 
profile: align macros args

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2 weeks agoprofile: use proper type to cleanup async
Shachar Sharon [Sun, 5 Jul 2026 08:31:45 +0000 (11:31 +0300)] 
profile: use proper type to cleanup async

Use proper type (struct smbprofile_stats_time_async) to reset-clean
upon ASYNC_END macro.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
3 weeks agotestenv: tmux does not allow "." or ":" in window names anymore
Volker Lendecke [Wed, 8 Jul 2026 12:01:59 +0000 (14:01 +0200)] 
testenv: tmux does not allow "." or ":" in window names anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jul  8 16:19:23 UTC 2026 on atb-devel-224

3 weeks agolibrpc: mark some types as obsolete as no longer used
Günther Deschner [Wed, 11 Feb 2026 16:48:43 +0000 (17:48 +0100)] 
librpc: mark some types as obsolete as no longer used

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jul  8 14:31:12 UTC 2026 on atb-devel-224

3 weeks agondr/security: Fix up SACLs broken by Samba before 4.18
Volker Lendecke [Fri, 29 May 2026 15:11:49 +0000 (17:11 +0200)] 
ndr/security: Fix up SACLs broken by Samba before 4.18

The information of the claims is lost, make smbd at least read the
full acl properly, synthesize an empty claims struct

Bug: https://bugzilla.samba.org/show_bug.cgi?id=16096
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agotests: Add test making sure we can parse an ACL broken by Samba < 4.19
Volker Lendecke [Fri, 29 May 2026 15:00:56 +0000 (17:00 +0200)] 
tests: Add test making sure we can parse an ACL broken by Samba < 4.19

The nice base64 blob you find here was retrieved from the
security.NTACL xattr when running the test from the previous patch
against a 4.18 server. The test has to be modified with a breakpoint()
right after the set_acl() call, because it cleans up the file after
the test, and it has to be run with a user that has the
SeSecurityPrivilege, i.e. typically and administrator. The resulting
security.NTACL xattr is broken.

I haven't found an easy way to inject this ACL into a running xattr
tdb file such that the posix hash function would make this survive a
get_nt_acl. A simple ndrdump should show the point.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=16096
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agotests: Test that we can set and receive a SACL
Oren Kishon [Fri, 29 May 2026 12:13:29 +0000 (14:13 +0200)] 
tests: Test that we can set and receive a SACL

Bug: https://bugzilla.samba.org/show_bug.cgi?id=16096
Signed-off-by: Oren Kishon <orenk@ctera.com>
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agotests: Add "systemuser" that is member of builtin\administrators
Volker Lendecke [Wed, 27 May 2026 15:33:07 +0000 (17:33 +0200)] 
tests: Add "systemuser" that is member of builtin\administrators

Give it SeSecurityPrivilege

Bug: https://bugzilla.samba.org/show_bug.cgi?id=16096
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 weeks agos4/torture/smb2: Port raw.streams subtest raw.streams.perms to SMB2
Noel Power [Tue, 4 Feb 2020 10:25:21 +0000 (10:25 +0000)] 
s4/torture/smb2: Port raw.streams subtest raw.streams.perms to SMB2

Mostly afaics raw.streams is already ported, the only test I saw that
was missing was the perms test. So this is added here.

Addionally
  o add  known fail for perms for streams_xattr and ntvfs
  o move the smb1 raw.streams to _smb1_done env
  o remove test from todo_smb2_tests_to_port.list
  o add a known fail for samba3.smb2.streams.perms(simpleserver)
    simpleserver is using vfs_streams_depot in preference to
    vfs_acl_xattr and the test seems to pass a check it expects
    an open of the stream to fail with ACCESS_DENIED but it
    passes (see https://bugzilla.samba.org/show_bug.cgi?id=16157)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Fri Jul  3 12:02:56 UTC 2026 on atb-devel-224

3 weeks agoaddns: Move DNS hand-marshalling smbtorture4
Volker Lendecke [Sun, 14 Jun 2026 07:04:10 +0000 (09:04 +0200)] 
addns: Move DNS hand-marshalling smbtorture4

Move it out of production code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jul  3 09:13:05 UTC 2026 on atb-devel-224

3 weeks agodnscli4: Convert dns_lookup() to NTSTATUS
Volker Lendecke [Sun, 14 Jun 2026 06:55:34 +0000 (08:55 +0200)] 
dnscli4: Convert dns_lookup() to NTSTATUS

Last external user of lib/addns/dnserr.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 weeks agoaddns: Clean up some includes of lib/addns/dns.h
Volker Lendecke [Sat, 13 Jun 2026 10:42:54 +0000 (12:42 +0200)] 
addns: Clean up some includes of lib/addns/dns.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 weeks agonet dns: Move "enum dns_ServerType" to its only user
Volker Lendecke [Sat, 13 Jun 2026 10:40:43 +0000 (12:40 +0200)] 
net dns: Move "enum dns_ServerType" to its only user

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>