]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 hours agoctdb-recoverd: Ensure an outgoing leader aborts recovery master
Martin Schwenke [Wed, 13 May 2026 12:04:53 +0000 (22:04 +1000)] 
ctdb-recoverd: Ensure an outgoing leader aborts recovery

Near the beginning of main_loop(), the node map is fetched and the
flags of the current node are saved.  Later in main_loop(), on the
leader node, decisions are made about whether a recovery is needed.
Between these times, the state of the leader node may have changed and
it may no longer be a viable leader, perhaps because it is inactive.
A state change affecting the viability of the leader may also be the
reason why recovery is needed.

Recovery sets the dmaster of records in volatile databases to the
leader.  If an outgoing, inactive leader runs recovery this results in
inconsistent databases.

So, fetch the flags for a node that is about to run recovery to ensure
that it is still a viable leader.  If it isn't a viable leader then
bail out and wait for an election to complete.

Here is an example showing a stopped node running recovery:

  2026-05-21T14:48:00.201838+10:00 node.0 ctdbd[5494]: Stopping node
  2026-05-21T14:48:00.202802+10:00 node.0 ctdbd[5494]: Making node INACTIVE
  2026-05-21T14:48:00.203891+10:00 node.0 ctdbd[5494]: Recovery mode set to ACTIVE
  2026-05-21T14:48:00.204981+10:00 node.0 ctdbd[5494]: Dropping all public IP addresses
  ...
  2026-05-21T14:48:00.240410+10:00 node.0 ctdbd[5494]: Freeze all
  2026-05-21T14:48:00.241286+10:00 node.0 ctdbd[5494]: Freeze db: rec_test.tdb
  2026-05-21T14:48:00.245207+10:00 node.0 ctdb-recoverd[5511]: Node:0 was in recovery mode. Start recovery process
  2026-05-21T14:48:00.245488+10:00 node.0 ctdb-recoverd[5511]: do_recovery: Starting do_recovery
  2026-05-21T14:48:00.245570+10:00 node.0 ctdb-recoverd[5511]: do_recovery: Recovery initiated due to problem with node 0
  2026-05-21T14:48:00.248315+10:00 node.0 ctdb-recoverd[5511]: do_recovery: Recovery - updated flags
  2026-05-21T14:48:00.255559+10:00 node.0 ctdbd[5494]: Connected client with pid:8656
  2026-05-21T14:48:00.258061+10:00 node.0 ctdb-recovery[8656]: Set recovery mode to ACTIVE
  2026-05-21T14:48:00.262878+10:00 node.0 ctdb-recovery[8656]: start_recovery event finished
  2026-05-21T14:48:00.263332+10:00 node.0 ctdb-recovery[8656]: updated VNNMAP
  2026-05-21T14:48:00.263363+10:00 node.0 ctdb-recovery[8656]: recover database 0x92421532
  2026-05-21T14:48:00.288708+10:00 node.0 ctdbd[5494]: ../../server/ctdb_daemon.c:323 Registered message handler for srvid=17294104044079415297
  2026-05-21T14:48:00.301158+10:00 node.0 ctdb-recovery[8656]: Pulled 1 records for db rec_test.tdb from node 1
  2026-05-21T14:48:00.301685+10:00 node.0 ctdbd[5494]: ../../server/ctdb_daemon.c:323 Registered message handler for srvid=17294104044079415298
  2026-05-21T14:48:00.314492+10:00 node.0 ctdb-recovery[8656]: Pulled 1 records for db rec_test.tdb from node 2
  2026-05-21T14:48:00.378047+10:00 node.0 ctdb-recovery[8656]: Pushed 1 records for db rec_test.tdb
  2026-05-21T14:48:00.383227+10:00 node.0 ctdb-recovery[8656]: 1 of 1 databases recovered
  2026-05-21T14:48:00.407982+10:00 node.0 ctdb-recovery[8656]: Set recovery mode to NORMAL
  2026-05-21T14:48:00.411630+10:00 node.0 ctdb-recovery[8656]: recovered event finished
  2026-05-21T14:48:00.411803+10:00 node.0 ctdb-recoverd[5511]: Takeover run starting
  ...
  2026-05-21T14:48:00.446576+10:00 node.0 ctdb-recoverd[5511]: Takeover run completed successfully
  2026-05-21T14:48:00.446784+10:00 node.0 ctdb-recoverd[5511]: do_recovery: Recovery complete
  ...
  2026-05-21T14:48:06.175857+10:00 node.0 ctdb-recoverd[5511]: Leader broadcast timeout
  2026-05-21T14:48:06.176067+10:00 node.0 ctdb-recoverd[5511]: Start election
  2026-05-21T14:48:06.178154+10:00 node.0 ctdbd[5494]: Recovery mode already set to ACTIVE
  2026-05-21T14:48:06.178519+10:00 node.0 ctdbd[5494]: Recovery mode already set to ACTIVE
  2026-05-21T14:48:06.737272+10:00 node.0 ctdb-recoverd[5511]: Received leader broadcast, leader=2

Recovery pulls records from and pushes records to the active nodes (1,
2).  However, the dmaster of all records will be 0.

This doesn't seem to occur often.  I can recreate it fairly easily if
I run ctdb/tests/INTEGRATION/database/recovery.003.no_resurrect.sh
under valgrind *and* apply a ctdb tool change that delays when "ctdb
stop" sends CTDB_SRVID_TAKEOVER_RUN.  Both only affect timing and not
overall recovery daemon behaviour.  However, there is currently
nothing stopping this behaviour.

In the example above, some time later, an election is held, another
node becomes leader and the new leader runs recovery:

  2026-05-21T14:48:06.175072+10:00 node.2 ctdb-recoverd[5704]: Leader broadcast timeout
  2026-05-21T14:48:06.176051+10:00 node.2 ctdb-recoverd[5704]: Start election
  2026-05-21T14:48:06.176913+10:00 node.2 ctdbd[5649]: Recovery mode set to ACTIVE
  2026-05-21T14:48:06.178319+10:00 node.2 ctdbd[5649]: Recovery mode already set to ACTIVE
  2026-05-21T14:48:06.178919+10:00 node.2 ctdbd[5649]: Recovery mode already set to ACTIVE
  2026-05-21T14:48:06.179961+10:00 node.2 ctdb-recoverd[5704]: Attempting to take cluster lock (./tests/var/INTEGRATION/database/shared/.ctdb/cluster.lock)
  2026-05-21T14:48:06.182192+10:00 node.2 ctdb-recoverd[5704]: Set cluster mutex helper to "/home/martins/samba/samba/ctdb/bin/ctdb_mutex_fcntl_helper"
  2026-05-21T14:48:06.202884+10:00 node.2 ctdb-recoverd[5704]: Cluster lock taken successfully
  2026-05-21T14:48:06.203876+10:00 node.2 ctdb-recoverd[5704]: Took cluster lock, leader=2
  2026-05-21T14:48:06.756771+10:00 node.2 ctdb-recoverd[5704]: Remote node 0 had flags 0x20, local had 0x0 - updating local
  2026-05-21T14:48:06.760258+10:00 node.2 ctdb-recoverd[5704]: Pushing updated flags for node 0 (0x20)
  2026-05-21T14:48:06.766434+10:00 node.2 ctdbd[5649]: Node 0 has changed flags - 0x0 -> 0x20
  2026-05-21T14:48:06.777574+10:00 node.2 ctdb-recoverd[5704]: Node:2 was in recovery mode. Start recovery process
  2026-05-21T14:48:06.778277+10:00 node.2 ctdb-recoverd[5704]: Node:1 was in recovery mode. Start recovery process
  2026-05-21T14:48:06.779017+10:00 node.2 ctdb-recoverd[5704]: do_recovery: Starting do_recovery

This makes the affected databases consistent again... and explains why
this hasn't been noticed before.

More details...

During recovery, recbuf_filter_add() sets the dmaster of records in a
volatile database to the leader.  If this node is inactive then
records with it as dmaster can't be migrated to other nodes after
recovery completes.  So, until another recovery occurs, the databases
are inconsistent and any attempts to fetch records will hang.

In terms of post-recovery distributed database performance, it might
make more sense for recovery to set each record's dmaster to its
lmaster.  However, that would cost an additional lmaster (i.e. hash)
calculation for each key.  So, setting the dmaster of records to be
the leader might be an important recovery performance optimisation.

This bug was found while testing a "leader resignation" change, which
aims to speed up operations like "ctdb stop" by having an outgoing
leader resign, so other nodes do not have to wait for a leader
broadcast timeout.  This change does not require recovery to be run
after an election if there is no other change to the
cluster (e.g. leader capability removed: orderly transfer of power).
For a stopped node, the new leader would run a recovery due to the
stopped node becoming inactive... unless the outgoing leader runs
recovery (as per this bug), which handles the cluster change so that
it is no longer exposed to the new leader.  So, with this bug and the
leader resignation change, the databases stay inconsistent until a
subsequent recovery.

Although it is theoretically unnecessary, it would be possible to have
leader resignation force a full election, which would always result in
recovery, but that is a question for another day.  The current
behaviour is wrong because a recovery run by an inactive leader leaves
volatile databases (at least temporarily) in an inconsistent state.
So, this needs to be fixed.

In the longer term, CTDB will hopefully become more modular.
Elections and database recovery will happen in different modules.
This situation will have to be carefully handled.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug  6 15:26:59 UTC 2026 on atb-devel-224

5 hours agoctdb-recoverd: Factor out fetching node map and local flags
Martin Schwenke [Wed, 13 May 2026 12:02:19 +0000 (22:02 +1000)] 
ctdb-recoverd: Factor out fetching node map and local flags

This will be used in more places.

Indexing by PNN is technically incorrect, so iterate to find the
correct slot in the nodemap.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
5 hours agoselftest: mark RpcdWitnessSambaTests as flapping
Stefan Metzmacher [Thu, 6 Aug 2026 13:52:32 +0000 (15:52 +0200)] 
selftest: mark RpcdWitnessSambaTests as flapping

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
5 hours agos3:smbXsrv.idl: change to SMBXSRV_VERSION_1
Stefan Metzmacher [Wed, 5 Aug 2026 21:16:18 +0000 (23:16 +0200)] 
s3:smbXsrv.idl: change to SMBXSRV_VERSION_1

Now that we suppose to support cluster upgrades
need to use a stable format.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 hours agos3:open_files.idl: use SHARE_MODE_DATA_VERSION_1 and VFS_DEFAULT_DURABLE_COOKIE_VERSI...
Stefan Metzmacher [Wed, 5 Aug 2026 20:01:13 +0000 (22:01 +0200)] 
s3:open_files.idl: use SHARE_MODE_DATA_VERSION_1 and VFS_DEFAULT_DURABLE_COOKIE_VERSION = 1

4.25 changed the formats, so bump the version. This gives us a way to autodetect
old formats easier in case cluster upgrades from older versions is implemented
in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 hours agos3:cluster_level.idl: use non legacy timeval
Stefan Metzmacher [Wed, 5 Aug 2026 19:39:28 +0000 (21:39 +0200)] 
s3:cluster_level.idl: use non legacy timeval

I was wondering about 44 bytes from the beginning,
but only looking at a hexdump of the record
revealed where the last 20 bytes came from.
4 bytes alignment, 8 bytes tv_sec, 4 bytes tv_usec.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 hours agopidl: allow embedded ref pointers for unions
Stefan Metzmacher [Thu, 6 Aug 2026 11:00:35 +0000 (13:00 +0200)] 
pidl: allow embedded ref pointers for unions

The support itself was added in this commit:

 commit e90c904a5f9b3b10a2e304be3a532ceb83424cb5
 Author: Stefan Metzmacher <metze@samba.org>
 Date:   Sat Mar 12 08:29:54 2005 +0000

     r5764: add support for embedded ref pointers

     metze
     (This used to be commit 112043b1809a96b1a39ade71ea2885c0d792c79f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 hours agolibrpc/ndr: fix ndr_{push,pull,print}_{timeval,timespec}() and add _legacy() compat
Stefan Metzmacher [Wed, 5 Aug 2026 17:39:33 +0000 (19:39 +0200)] 
librpc/ndr: fix ndr_{push,pull,print}_{timeval,timespec}() and add _legacy() compat

Scalar types should do nothing when called with NDR_BUFFERS,
the current timeval and timespec encode the values twice.

In order to keep compat with the former behavior we have
timeval_legacy and timespec_legacy.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 hours agolib/util: make generate_unique_u64() more robust
Stefan Metzmacher [Wed, 5 Aug 2026 20:03:53 +0000 (22:03 +0200)] 
lib/util: make generate_unique_u64() more robust

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
30 hours agos4:kdc: fix NULL pointer dereference of client entry gitlab/master
Egor Mikhailov [Fri, 5 Jun 2026 16:10:19 +0000 (20:10 +0400)] 
s4:kdc: fix NULL pointer dereference of client entry

Client can be NULL if the principal
is not found in the DB, but it is later dereferenced inside
mit_samba_check_client_access().

If client is NULL, we should return KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN
early, as we cannot check policies without the client database entry.

Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Egor Mikhailov <mikhailovev@sgu.ru>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Aug  5 13:54:56 UTC 2026 on atb-devel-224

31 hours agosamba_kcc: Deduplicate lsite assignment
Petr Usoltsev [Wed, 5 Aug 2026 05:19:55 +0000 (13:19 +0800)] 
samba_kcc: Deduplicate lsite assignment

Signed-off-by: Petr Usoltsev <usoltsevpv@basealt.ru>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Aug  5 12:34:48 UTC 2026 on atb-devel-224

2 days agoWHATSNEW: Cluster functional level
Stefan Metzmacher [Mon, 27 Jul 2026 18:21:45 +0000 (20:21 +0200)] 
WHATSNEW: Cluster functional level

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Aug  4 10:55:37 UTC 2026 on atb-devel-224

2 days agos3:utils: introduce 'net clusterlevel [features|show|showall|upgrade]' commands
Stefan Metzmacher [Fri, 24 Jul 2026 14:54:17 +0000 (16:54 +0200)] 
s3:utils: introduce 'net clusterlevel [features|show|showall|upgrade]' commands

These commands are able to manage the cluster functional level.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:cluster_level_db: add cluster_level_db_upgrade()
Stefan Metzmacher [Fri, 31 Jul 2026 08:07:58 +0000 (10:07 +0200)] 
s3:cluster_level_db: add cluster_level_db_upgrade()

This verifies all nodes are supporting the same ranges
and then upgrades to the highest possible level.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:messages: add MSG_CLUSTER_LEVEL_UPGRADED handler
Stefan Metzmacher [Mon, 27 Jul 2026 14:08:54 +0000 (16:08 +0200)] 
s3:messages: add MSG_CLUSTER_LEVEL_UPGRADED handler

This makes it possible notify all processes
connected ctdbd to reload the cluster functional level
from cluster_level.tdb.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agomessaging.idl: define MSG_CLUSTER_LEVEL_UPGRADED
Stefan Metzmacher [Mon, 27 Jul 2026 12:47:16 +0000 (14:47 +0200)] 
messaging.idl: define MSG_CLUSTER_LEVEL_UPGRADED

This will be used to inform all processes connected
to ctdbd that the cluster functional level was
upgraded and processes should re-check the value
stored in cluster_level.tdb.

The message itself doesn't have any payload.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:cluster_level_db: add cluster_level_db_nodes_foreach()
Stefan Metzmacher [Fri, 31 Jul 2026 07:50:16 +0000 (09:50 +0200)] 
s3:cluster_level_db: add cluster_level_db_nodes_foreach()

This allows the caller to get information about the supported
ranges of all (non-deleted) nodes together with information
about the node.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:ctdbd_conn: add ctdbd_nodes_foreach() helper
Stefan Metzmacher [Fri, 24 Jul 2026 16:01:41 +0000 (18:01 +0200)] 
s3:ctdbd_conn: add ctdbd_nodes_foreach() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:cluster_support: add SMB_ASSERT(!lp_clustering()); to cluster_level_activate_latest()
Stefan Metzmacher [Sat, 18 Jul 2026 13:52:48 +0000 (15:52 +0200)] 
s3:cluster_support: add SMB_ASSERT(!lp_clustering()); to cluster_level_activate_latest()

The cluster cases should use cluster_level_activate() instead.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:messages: let messaging_init_internal() call cluster_level_db_check_or_update()
Stefan Metzmacher [Wed, 15 Jul 2026 18:07:08 +0000 (20:07 +0200)] 
s3:messages: let messaging_init_internal() call cluster_level_db_check_or_update()

This makes sure we prepare the cluster level state before
we do any real work.

We only call cluster_level_db_check_or_update() if needed.

It also prepares the global state so that
cluster_level_activated() can work as desired.

Review with: git show -w --patience

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:cluster_level_db: add cluster_level_db_check_or_update()
Stefan Metzmacher [Thu, 16 Jul 2026 12:39:41 +0000 (14:39 +0200)] 
s3:cluster_level_db: add cluster_level_db_check_or_update()

This creates the global record for the active level,
when there's none.

And it creates/updates the per node record of supported
level ranges.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:lib: introduce cluster_level_db.[ch] with cluster_level_db_check()
Stefan Metzmacher [Tue, 14 Jul 2026 16:17:37 +0000 (18:17 +0200)] 
s3:lib: introduce cluster_level_db.[ch] with cluster_level_db_check()

This implements getting the global cluster functional level
state (struct cluster_level_active) in read-only mode from
cluster_level.tdb, supposed to be used by the low-level
ctdbd_connection code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:ctdbd_conn: add ctdbd_conn_{get,set}_cluster_level() helper functions
Stefan Metzmacher [Wed, 15 Jul 2026 13:30:11 +0000 (15:30 +0200)] 
s3:ctdbd_conn: add ctdbd_conn_{get,set}_cluster_level() helper functions

These will be used in the next steps...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:messages: call cluster_level_activate_latest() in messaging_init_internal()
Stefan Metzmacher [Fri, 17 Jul 2026 19:04:03 +0000 (21:04 +0200)] 
s3:messages: call cluster_level_activate_latest() in messaging_init_internal()

This is just the first step to always use the latest level
defined by the software.

A following commit will change the logic for the clustered case
and call cluster_level_activate() instead, which a value found
in a cluster wide database.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:lib: add cluster_level related functions to cluster_support.[ch]
Stefan Metzmacher [Tue, 14 Jul 2026 16:14:33 +0000 (18:14 +0200)] 
s3:lib: add cluster_level related functions to cluster_support.[ch]

This represents our global state related to cluster functional levels.

This doesn't really depend on enabled cluserter support,
but allows the core code to work without #ifdef's.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:librpc: add cluster_level.idl
Stefan Metzmacher [Tue, 14 Jul 2026 14:59:07 +0000 (16:59 +0200)] 
s3:librpc: add cluster_level.idl

This defines the basic structure to implement
a cluster wide functional level.

Upstream (master) will basically update the major number
if a incompatible change was made, similar to
SMB_VFS_INTERFACE_VERSION, at the same time
minor latest is changes to 0.

For any backport the minor number needs to
be updated there.

See also the large comments in the file itself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:ctdbd_conn: let ctdbd_init_connection_internal() get the pid and start_time of...
Stefan Metzmacher [Tue, 14 Jul 2026 14:31:21 +0000 (16:31 +0200)] 
s3:ctdbd_conn: let ctdbd_init_connection_internal() get the pid and start_time of ctdbd

This will allow the caller to identify database records valid for
the lifetime of the current ctdbd.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:dbwrap_open: protect db_open() against recursive calls
Stefan Metzmacher [Sat, 18 Jul 2026 11:36:03 +0000 (13:36 +0200)] 
s3:dbwrap_open: protect db_open() against recursive calls

Callers need to use db_open_ex() instead.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:dbwrap_ctdb: let db_open_ctdb_ex() use g_lock_ctx_init_ex()
Stefan Metzmacher [Thu, 16 Jul 2026 09:17:17 +0000 (11:17 +0200)] 
s3:dbwrap_ctdb: let db_open_ctdb_ex() use g_lock_ctx_init_ex()

This will allow db_open_ctdb_ex() to work without
global state to be setup first.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:g_lock: split out g_lock_ctx_init_ex()
Stefan Metzmacher [Thu, 16 Jul 2026 09:10:35 +0000 (11:10 +0200)] 
s3:g_lock: split out g_lock_ctx_init_ex()

This prepares us to allow to open a
persistent database in read-write mode
with transactions during early startup
where we don't have global state yet.

This asserts that g_lock_ctx_init() can't
be called recursively.

It will be used in db_open_ctdb_ex()
in the next step.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:dbwrap_open: split out db_open_ex()
Stefan Metzmacher [Thu, 16 Jul 2026 09:04:15 +0000 (11:04 +0200)] 
s3:dbwrap_open: split out db_open_ex()

This will allow us to open a persistent database
in read-only mode without allowing transactions.

It allows otherwise global state to be passed down
to db_open_ctdb_ex().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:dbwrap_ctdb: split out db_open_ctdb_ex()
Stefan Metzmacher [Tue, 14 Jul 2026 11:45:53 +0000 (13:45 +0200)] 
s3:dbwrap_ctdb: split out db_open_ctdb_ex()

This will allow us to open a persistent database
in read-only mode without allowing transactions.

We'll use that in order to implement a
"cluster_level.tdb" in order to
add support for controlled cluster upgrades
in the next steps.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:global_contexts: add global_messaging_context_raw()
Stefan Metzmacher [Sat, 18 Jul 2026 10:51:29 +0000 (12:51 +0200)] 
s3:global_contexts: add global_messaging_context_raw()

This gets the global context without trying to
create a fresh one.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:g_lock: let g_lock_trylock() debug if exclusive locker died
Stefan Metzmacher [Fri, 17 Jul 2026 11:21:26 +0000 (13:21 +0200)] 
s3:g_lock: let g_lock_trylock() debug if exclusive locker died

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:ctdbd_conn: remove unused ctdbd_reinit_connection()
Stefan Metzmacher [Thu, 16 Jul 2026 10:05:07 +0000 (12:05 +0200)] 
s3:ctdbd_conn: remove unused ctdbd_reinit_connection()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agolib/replace: add BUILD_ASSERT()
Stefan Metzmacher [Wed, 4 Mar 2026 15:39:10 +0000 (16:39 +0100)] 
lib/replace: add BUILD_ASSERT()

This uses _Static_assert() from C11...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agos3:utils: don't allow misc options to 'net join'
Stefan Metzmacher [Tue, 21 Jul 2026 10:19:01 +0000 (12:19 +0200)] 
s3:utils: don't allow misc options to 'net join'

The code from net_ads_join looks at misc options in argv
and also gets a domain name, which might not be our workgroup
nor realm.

The net_rpc_join doesn't do that, instead of uses
the misc options as join type and the domain from
lp_workgroup().

This means the generic 'net join' can't handle
misc options in a sane way.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agoselftest:Samba3: remove useless 'member' argument and use 'net ads join'
Stefan Metzmacher [Tue, 21 Jul 2026 10:16:50 +0000 (12:16 +0200)] 
selftest:Samba3: remove useless 'member' argument and use 'net ads join'

The net_ads_join code path tries to join a domain called 'MEMBER'
and only the fallback to net_rpc_join lets this work at all.

The net_rpc_join code path tries to convert the argument
to a join type.

So use a command real admins will use.

I noticed this as I was wondering about the message:

 ADS join did not work, falling back to RPC...

on the screen when starting the 'clusteredmember'
environment.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 days agonet.8.xml: document 'net serverid wipedbs --persistent'
Stefan Metzmacher [Wed, 29 Jul 2026 11:38:22 +0000 (13:38 +0200)] 
net.8.xml: document 'net serverid wipedbs --persistent'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
3 days agosmbd: Make reference_smb_fname_fsp_link() static
Volker Lendecke [Fri, 19 Dec 2025 13:27:41 +0000 (14:27 +0100)] 
smbd: Make reference_smb_fname_fsp_link() static

Only referenced in files.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Aug  3 10:08:42 UTC 2026 on atb-devel-224

3 days agospnego: Use struct initialization instead of talloc_zero
Volker Lendecke [Fri, 3 Jul 2026 14:02:45 +0000 (16:02 +0200)] 
spnego: Use struct initialization instead of talloc_zero

Also remove some NULL initializations that are implicitly done. I
know, cosmetic change, I like it better this way...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolibcli: Slightly streamline sddl_flags_to_string()
Volker Lendecke [Thu, 30 Jul 2026 12:25:54 +0000 (14:25 +0200)] 
libcli: Slightly streamline sddl_flags_to_string()

Only check for talloc failure once with talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agospnego: We have gensec_get_unparsed_target_principal() now
Volker Lendecke [Mon, 6 Jul 2026 11:06:40 +0000 (13:06 +0200)] 
spnego: We have gensec_get_unparsed_target_principal() now

It does exactly what the callers did before this patch.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agospnego: Remove a pointless return;
Volker Lendecke [Fri, 3 Jul 2026 10:00:31 +0000 (12:00 +0200)] 
spnego: Remove a pointless return;

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agospnego: Doesn't need base64.h
Volker Lendecke [Fri, 3 Jul 2026 15:54:13 +0000 (17:54 +0200)] 
spnego: Doesn't need base64.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Streamline a struct assignment
Volker Lendecke [Thu, 2 Jul 2026 11:40:04 +0000 (13:40 +0200)] 
lib: Streamline a struct assignment

No need to do the struct assignment and then modify the struct in a separate
step.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agogensec: Simplify domain match check
Volker Lendecke [Mon, 6 Jul 2026 12:02:24 +0000 (14:02 +0200)] 
gensec: Simplify domain match check

We don't have to look for our domain twice, once for the check and
once for the DBG_NOTICE.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agogensec: Declare vars closer to their use
Volker Lendecke [Mon, 6 Jul 2026 11:59:26 +0000 (13:59 +0200)] 
gensec: Declare vars closer to their use

We don't need "workstation" and "domain" in the client case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolibcli: Use #defines instead of magic numbers
Volker Lendecke [Thu, 30 Jul 2026 11:39:33 +0000 (13:39 +0200)] 
libcli: Use #defines instead of magic numbers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolibcli: Fix whitespace
Volker Lendecke [Thu, 30 Jul 2026 11:40:36 +0000 (13:40 +0200)] 
libcli: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agontlmssp: Tiny simplification of gensec_ntlmssp_server_negotiate()
Volker Lendecke [Mon, 6 Jul 2026 12:13:37 +0000 (14:13 +0200)] 
ntlmssp: Tiny simplification of gensec_ntlmssp_server_negotiate()

Do an early return instead of an else. While there, modernize DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agogensec: Add GENSEC_OID_NEGOEX
Volker Lendecke [Thu, 30 Jul 2026 10:59:15 +0000 (12:59 +0200)] 
gensec: Add GENSEC_OID_NEGOEX

Unused so far, bug so is GENSEC_OID_KERBEROS5_USER2USER

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agontlmssp: Avoid an "else", we return early
Volker Lendecke [Fri, 3 Jul 2026 16:11:14 +0000 (18:11 +0200)] 
ntlmssp: Avoid an "else", we return early

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Make asn1_peek() static
Volker Lendecke [Mon, 26 Jan 2026 10:56:45 +0000 (11:56 +0100)] 
lib: Make asn1_peek() static

Only used in asn1.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agogensec: Fix a copy&paste error
Volker Lendecke [Mon, 6 Jul 2026 10:58:46 +0000 (12:58 +0200)] 
gensec: Fix a copy&paste error

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agogensec: Fix a use-after-free error in gensec_external
Volker Lendecke [Mon, 6 Jul 2026 11:34:11 +0000 (13:34 +0200)] 
gensec: Fix a use-after-free error in gensec_external

.length is 0, but the pointer we hand out will be != NULL but free'ed
in the tevent_req_received()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agorpcclient: Align a few integer types
Volker Lendecke [Sat, 11 Jul 2026 11:06:26 +0000 (13:06 +0200)] 
rpcclient: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agorpcclient: Use #define
Volker Lendecke [Sat, 11 Jul 2026 10:59:38 +0000 (12:59 +0200)] 
rpcclient: Use #define

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agosmbclient3: Slightly simplify target IP handling
Volker Lendecke [Mon, 11 May 2026 07:12:44 +0000 (09:12 +0200)] 
smbclient3: Slightly simplify target IP handling

Instead of using ?: in a few places, introduce a pointer variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolibsmb: dsgetdcname.h requires NTSTATUS
Volker Lendecke [Tue, 10 Mar 2026 10:34:17 +0000 (11:34 +0100)] 
libsmb: dsgetdcname.h requires NTSTATUS

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agosmbclient3: Remove an unused variable
Volker Lendecke [Mon, 11 May 2026 06:56:48 +0000 (08:56 +0200)] 
smbclient3: Remove an unused variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agosmbd: Fix whitespace, modernize a DEBUG
Volker Lendecke [Tue, 26 May 2026 12:59:28 +0000 (14:59 +0200)] 
smbd: Fix whitespace, modernize a DEBUG

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agodns_server: Use talloc_realloc_zero() to avoid explicit ZERO_STRUCT()
Volker Lendecke [Wed, 17 Jun 2026 06:02:35 +0000 (08:02 +0200)] 
dns_server: Use talloc_realloc_zero() to avoid explicit ZERO_STRUCT()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agovfs_cap: Rename confusing "path" parameter
Volker Lendecke [Mon, 22 Jun 2026 15:25:19 +0000 (17:25 +0200)] 
vfs_cap: Rename confusing "path" parameter

This is the xattr name, not the path

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Make signed/unsigned conversion explicit in asn1_peek()
Volker Lendecke [Tue, 21 Jul 2026 10:38:17 +0000 (12:38 +0200)] 
lib: Make signed/unsigned conversion explicit in asn1_peek()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Make signed/unsigned conversion explicit in asn1_write()
Volker Lendecke [Tue, 21 Jul 2026 10:31:38 +0000 (12:31 +0200)] 
lib: Make signed/unsigned conversion explicit in asn1_write()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Add central error: exit to asn1_write()
Volker Lendecke [Tue, 21 Jul 2026 10:27:42 +0000 (12:27 +0200)] 
lib: Add central error: exit to asn1_write()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agoldap_server: Fix -Wswitch in case we want to implement SICILY
Volker Lendecke [Tue, 21 Jul 2026 09:50:10 +0000 (11:50 +0200)] 
ldap_server: Fix -Wswitch in case we want to implement SICILY

See [MS-ADTS] 5.1.1.1.3 Sicily Authentication

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: One last check before subtraction in asn1_tag_remaining()
Volker Lendecke [Tue, 21 Jul 2026 09:17:33 +0000 (11:17 +0200)] 
lib: One last check before subtraction in asn1_tag_remaining()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Make "remaining" unsigned in asn1_tag_remaining()
Volker Lendecke [Tue, 21 Jul 2026 09:14:33 +0000 (11:14 +0200)] 
lib: Make "remaining" unsigned in asn1_tag_remaining()

We checked it can't go negative, avoid signed/unsigned comparisons

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Check there's data remaining before calculating how much
Volker Lendecke [Tue, 21 Jul 2026 09:06:53 +0000 (11:06 +0200)] 
lib: Check there's data remaining before calculating how much

Better make sure the subtraction does not go negative before we do it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Add some consistency check to asn1_tag_remaining()
Volker Lendecke [Tue, 21 Jul 2026 09:03:59 +0000 (11:03 +0200)] 
lib: Add some consistency check to asn1_tag_remaining()

We can't allow "ofs" to be smaller than "nesting->start". This
assumption is implicitly valid, but better be safe than sorry.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Simplify asn1_tag_remaining()
Volker Lendecke [Tue, 21 Jul 2026 08:52:55 +0000 (10:52 +0200)] 
lib: Simplify asn1_tag_remaining()

Introduce common error exit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agolib: Simplify libnet_vampire_cb_apply_schema()
Volker Lendecke [Wed, 15 Jul 2026 11:02:39 +0000 (13:02 +0200)] 
lib: Simplify libnet_vampire_cb_apply_schema()

Use talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agorpc_server: Simplify dcesrv_samr_GetAliasMembership()
Volker Lendecke [Wed, 15 Jul 2026 11:00:27 +0000 (13:00 +0200)] 
rpc_server: Simplify dcesrv_samr_GetAliasMembership()

Use talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agorpcclient: Fix handling of -1 return from tsocket_address_bsd_sockaddr
Volker Lendecke [Mon, 13 Jul 2026 21:55:10 +0000 (23:55 +0200)] 
rpcclient: Fix handling of -1 return from tsocket_address_bsd_sockaddr

socklen_t can be unsigned

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agonetlogond: Fix a typo
Volker Lendecke [Sun, 12 Jul 2026 08:32:52 +0000 (10:32 +0200)] 
netlogond: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agopdb_samba_dsdb: Simplify pdb_samba_dsdb_get_domain_info()
Volker Lendecke [Sun, 12 Jul 2026 08:01:45 +0000 (10:01 +0200)] 
pdb_samba_dsdb: Simplify pdb_samba_dsdb_get_domain_info()

"dom_res" is a talloc child of "info"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agopdb_samba_dsdb: Add a talloc failure check
Volker Lendecke [Sun, 12 Jul 2026 08:01:00 +0000 (10:01 +0200)] 
pdb_samba_dsdb: Add a talloc failure check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agopdb_samba_dsdb: We should not run with a zero domain guid
Volker Lendecke [Sun, 12 Jul 2026 07:59:38 +0000 (09:59 +0200)] 
pdb_samba_dsdb: We should not run with a zero domain guid

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agopdb_samba_dsdb: Simplify pdb_samba_dsdb_search_filter() with a central exit
Volker Lendecke [Sun, 12 Jul 2026 07:38:19 +0000 (09:38 +0200)] 
pdb_samba_dsdb: Simplify pdb_samba_dsdb_search_filter() with a central exit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agopdb_samba_dsdb: Fix an error return
Volker Lendecke [Sun, 12 Jul 2026 07:36:28 +0000 (09:36 +0200)] 
pdb_samba_dsdb: Fix an error return

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
3 days agopdb_samba_dsdb: talloc_stackframe() panics on failure
Volker Lendecke [Sun, 12 Jul 2026 07:35:49 +0000 (09:35 +0200)] 
pdb_samba_dsdb: talloc_stackframe() panics on failure

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
5 days agos4:libcli/resolve: let lpcfg_resolve_context() take an explicit mem_ctx
Stefan Metzmacher [Thu, 30 Jul 2026 19:01:09 +0000 (21:01 +0200)] 
s4:libcli/resolve: let lpcfg_resolve_context() take an explicit mem_ctx

This avoids memory leaks in various places.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Aug  1 09:11:02 UTC 2026 on atb-devel-224

5 days agos4:py_net: make use of self->libnet_ctx->resolve_ctx
Stefan Metzmacher [Thu, 30 Jul 2026 18:58:18 +0000 (20:58 +0200)] 
s4:py_net: make use of self->libnet_ctx->resolve_ctx

There's no need to call lpcfg_resolve_context() every time again.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 days agoctdb-common: Align integer types
Martin Schwenke [Thu, 30 Jul 2026 04:49:16 +0000 (14:49 +1000)] 
ctdb-common: Align integer types

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): Fri Jul 31 00:48:24 UTC 2026 on atb-devel-224

6 days agoctdb-common: Avoid Coverity 1697470/1697471
Martin Schwenke [Thu, 30 Jul 2026 02:21:10 +0000 (12:21 +1000)] 
ctdb-common: Avoid Coverity 1697470/1697471

These are listed as: Memory - corruptions (OVERRUN)

While sockaddr_ll only has 8 octets for sll_addr, a sockaddr_storage
is being intentionally used here to provide additional space.  So, the
overrun is a technicality and there is no corruption.

However, the code is incorrect because it does overrun sll_addr[] in
sockaddr_ll.  The assignments into out-of-bounds indices also cause
the -O3 build fail.

So, use an extra variable to point to where sll_addr should start in a
sockaddr_storage and index from there.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
6 days agoctdb-tests: Add tests for build of IPv6 link-level multicast address
Martin Schwenke [Thu, 30 Jul 2026 03:27:24 +0000 (13:27 +1000)] 
ctdb-tests: Add tests for build of IPv6 link-level multicast address

This is mainly to guard against regressions in known working code.
Test before the changes, test again afterwards...

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
7 days agotevent: version 0.17.2 tevent-0.17.2
Stefan Metzmacher [Fri, 20 Mar 2026 09:55:08 +0000 (10:55 +0100)] 
tevent: version 0.17.2

* let tevent_common_have_events() ignore fd events without active flags,
  in order to avoid tevent_loop_wait() to loop forever with only
  such events.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 30 19:53:15 UTC 2026 on atb-devel-224

7 days agotevent: ignore fd events without flags in tevent_common_have_events()
Stefan Metzmacher [Fri, 20 Mar 2026 09:51:42 +0000 (10:51 +0100)] 
tevent: ignore fd events without flags in tevent_common_have_events()

Allow callers to use tevent_add_fd() with flags=0 in order
to allocate the memory, but without waiting for any event.

This should not cause tevent_loop_wait() to loop forever
if such an fd event is the only event.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 days agolib: Fix undefined behaviour at fork time in pthreadpool
Volker Lendecke [Tue, 28 Jul 2026 11:25:43 +0000 (13:25 +0200)] 
lib: Fix undefined behaviour at fork time in pthreadpool

If a pthread times out at the same time with a fork, ETIMEDOUT is
overwritten and not being taken care of. This means that we can race
with the forking thread destroying pool->condvar in the next round of
the thread's while(1) loop. pthread_cond_wait() on a condition
variable that has been destroyed is not a good idea.

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

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): Thu Jul 30 17:51:29 UTC 2026 on atb-devel-224

7 days agorpc_server: Simplify dns_split_node_name()
Volker Lendecke [Wed, 15 Jul 2026 10:58:02 +0000 (12:58 +0200)] 
rpc_server: Simplify dns_split_node_name()

Use talloc_asprintf_addsep()

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): Thu Jul 30 14:14:44 UTC 2026 on atb-devel-224

7 days agovfs_ceph_rgw: Simplify normalise_name()
Volker Lendecke [Wed, 15 Jul 2026 10:22:24 +0000 (12:22 +0200)] 
vfs_ceph_rgw: Simplify normalise_name()

Use talloc_asprintf_addsep()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agosmbd: Simplify msdfs_link_string()
Volker Lendecke [Wed, 15 Jul 2026 10:12:21 +0000 (12:12 +0200)] 
smbd: Simplify msdfs_link_string()

Use talloc_asprintf_addsep()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agosmbd: Simplify full_path_extend()
Volker Lendecke [Wed, 15 Jul 2026 10:10:42 +0000 (12:10 +0200)] 
smbd: Simplify full_path_extend()

Use talloc_asprintf_addsep()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agoldb: ldb_dn_get_extended_linearized()
Volker Lendecke [Wed, 15 Jul 2026 10:06:40 +0000 (12:06 +0200)] 
ldb: ldb_dn_get_extended_linearized()

Use talloc_asprintf_addsep()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agoldb: Slightly simplify ldb_dn_get_extended_linearized()
Volker Lendecke [Tue, 14 Jul 2026 19:55:49 +0000 (21:55 +0200)] 
ldb: Slightly simplify ldb_dn_get_extended_linearized()

Return early with dn->ext_comp_num==0, no need to check further down again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agoldb: Simplify ldif_write_prefixMap()
Volker Lendecke [Wed, 15 Jul 2026 10:04:45 +0000 (12:04 +0200)] 
ldb: Simplify ldif_write_prefixMap()

Use talloc_asprintf_addsep()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agoldb: Fix ldif_write_prefixMap()
Volker Lendecke [Wed, 15 Jul 2026 10:03:51 +0000 (12:03 +0200)] 
ldb: Fix ldif_write_prefixMap()

talloc_asprintf_addbuf() deals well with allocation failure, but we
need to check failure after the string has been set up.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 days agoctdb: Simplify compact_args()
Volker Lendecke [Wed, 15 Jul 2026 10:01:25 +0000 (12:01 +0200)] 
ctdb: Simplify compact_args()

Use talloc_asprintf_addsep()

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