]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 days agoVERSION: Bump version up to Samba 4.23.0rc2... v4-23-test
Jule Anger [Thu, 7 Aug 2025 15:03:47 +0000 (17:03 +0200)] 
VERSION: Bump version up to Samba 4.23.0rc2...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 days agoVERSION: Disable GIT_SNAPSHOT for the Samba 4.23.0rc1 release. v4-23-stable samba-4.23.0rc1
Jule Anger [Thu, 7 Aug 2025 11:33:08 +0000 (13:33 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the Samba 4.23.0rc1 release.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 days agoWHATSNEW: Up to Samba 4.23.0rc1.
Jule Anger [Thu, 7 Aug 2025 11:32:00 +0000 (13:32 +0200)] 
WHATSNEW: Up to Samba 4.23.0rc1.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 days agoWHATSNEW: add smb.conf changes and titles for new features
Jule Anger [Thu, 7 Aug 2025 12:25:15 +0000 (14:25 +0200)] 
WHATSNEW: add smb.conf changes and titles for new features

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 days agotevent: version 0.17.1 tevent-0.17.1
Jule Anger [Thu, 7 Aug 2025 10:01:59 +0000 (12:01 +0200)] 
tevent: version 0.17.1

* Coverity checks:
    Fix 1649525 Use of 32-bit time_t
    Fix Coverity ID 1649524 Dereference before null check
    Fix Coverity ID 1649526 Dereference before null check

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 days agotdb: version 1.4.14 tdb-1.4.14
Jule Anger [Thu, 7 Aug 2025 10:01:48 +0000 (12:01 +0200)] 
tdb: version 1.4.14

* let tdbtool return error on failure (BUG 15890)

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 days agos3:passdb: Fix CIDs 1596750,1596751 uninitialized pointer read
Michael Adam [Wed, 6 Aug 2025 09:27:48 +0000 (11:27 +0200)] 
s3:passdb: Fix CIDs 1596750,1596751 uninitialized pointer read

This fixes two coverity issues of type

CID 1596750 - uninitialized pointer read
CID 1596751 - uninitialized pointer read

 It fixes one occurrence in each of
pdb_samba_dsdb_create_user and pdb_samba_dsdb_create_alias

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Rabinarayan Panigrahi <rapanigr@redhat.com>
Reviewed-by: Shachar Sharon <ssharon@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Aug  7 11:20:25 UTC 2025 on atb-devel-224

2 days agolibcli/security: use talloc_free at the end of sub-tests
Rabinarayan Panigrahi [Sun, 3 Aug 2025 14:44:17 +0000 (20:14 +0530)] 
libcli/security: use talloc_free at the end of sub-tests

Memory should be free by talloc_free() if it is allocated using talloc_new()

Signed-off-by: Rabinarayan Panigrahi <rapanigr@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Aug  7 09:02:29 UTC 2025 on atb-devel-224

3 days agoctdb: Fix a stuck cluster lock holder after a delayed leader bcast
Volker Lendecke [Wed, 6 Aug 2025 13:28:29 +0000 (15:28 +0200)] 
ctdb: Fix a stuck cluster lock holder after a delayed leader bcast

If a delayed broadcast by a previous cluster lock holder arrives, the
new legitimate leader will accept this without questioning in
leader_handler(). Without this patch rec->leader will never be
overwritten, and because rec->pnn != rec->leader we'll also never send
out fresh leader broadcasts. And because we hold the cluster lock,
nobody else can step up.

Fix this in the next round of leader broadcast timeout.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15892
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Aug  7 02:59:20 UTC 2025 on atb-devel-224

3 days agolibrpc:ndr:keycredlink don't require that kmi be a talloc_context
Gary Lockyer [Wed, 6 Aug 2025 01:03:30 +0000 (13:03 +1200)] 
librpc:ndr:keycredlink don't require that kmi be a talloc_context

This prevents fuzzing of ndr_pull_KeyMaterialInternal which we want. So instead
allocate against the ndr talloc context, then the callers can talloc_steal,
memcpy the data as appropriate.

 5 abort
 6 talloc_abort samba/lib/talloc/talloc.c:506:3
 7 talloc_chunk_from_ptr samba/lib/talloc/talloc.c:0
 8 __talloc_with_prefix samba/lib/talloc/talloc.c:762:12
 9 __talloc samba/lib/talloc/talloc.c:825:9
10 _talloc_named_const samba/lib/talloc/talloc.c:982:8
11 _talloc_memdup samba/lib/talloc/talloc.c:2441:9
12 data_blob_talloc_named samba/lib/util/data_blob.c:56:25
13 pull_BCRYPT_RSAPUBLIC_BLOB samba/librpc/ndr/ndr_keycredlink.c:878:17
14 ndr_pull_KeyMaterialInternal samba/librpc/ndr/ndr_keycredlink.c:959:10
15 LLVMFuzzerTestOneInput samba/bin/default/lib/fuzzing/
               fuzz_ndr_keycredlink_TYPE_STRUCT.c:282:13

REF: https://issues.oss-fuzz.com/issues/435760432

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Aug  6 05:10:43 UTC 2025 on atb-devel-224

3 days agos4:kdc:db-glue talloc steal pub_key data
Gary Lockyer [Wed, 6 Aug 2025 01:00:32 +0000 (13:00 +1200)] 
s4:kdc:db-glue talloc steal pub_key data

talloc_steal the data pointers of pub_key, modulus and exponent onto pub_key.
To allow fuzz testing of ndr_pull_KeyMaterialInternal the KeyMaterialInternal
struct may not be a talloc_context.  So the data portions will be allocated on
the ndr context.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 days agolibrpc:ndr:keycredlink clean up includes
Gary Lockyer [Wed, 6 Aug 2025 00:58:45 +0000 (12:58 +1200)] 
librpc:ndr:keycredlink clean up includes

Remove redundant and unused includes from librpc/ndr/ndr_keycredlink.c

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 days agodocs: document serverid command
Ralph Boehme [Fri, 11 Jul 2025 12:29:38 +0000 (14:29 +0200)] 
docs: document serverid command

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Aug  5 16:03:56 UTC 2025 on atb-devel-224

4 days agonet: add `net tdb smbXsrv wipedbs` alias for `net serverid wipedbs`
Ralph Boehme [Sun, 29 Jun 2025 16:04:41 +0000 (18:04 +0200)] 
net: add `net tdb smbXsrv wipedbs` alias for `net serverid wipedbs`

`net serverid` is imho not the right place for the wipedbs functionality. Add
it as an alias to `net tdb`. It works pretty opaque and unless you run

 # net tdb smbXsrv wipedbs --help
 Usage:
 net serverid wipedbs [--test] [--verbose]
 Example:
 net serverid wipedbs -v

the use won't notice it is an alias.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agonet: handle replay records in `net serverid wipedbs`
Ralph Boehme [Sat, 26 Jul 2025 13:27:41 +0000 (15:27 +0200)] 
net: handle replay records in `net serverid wipedbs`

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: return replay-cache records in smbXsrv_open_global_traverse()
Ralph Boehme [Fri, 11 Jul 2025 04:30:15 +0000 (06:30 +0200)] 
smbd: return replay-cache records in smbXsrv_open_global_traverse()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: reformat smbXsrv_open_global_traverse() function pointer args
Ralph Boehme [Tue, 17 Jun 2025 14:13:52 +0000 (16:13 +0200)] 
smbd: reformat smbXsrv_open_global_traverse() function pointer args

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: also delete replay cache record in smbXsrv_open_cleanup()
Ralph Boehme [Tue, 17 Jun 2025 14:59:07 +0000 (16:59 +0200)] 
smbd: also delete replay cache record in smbXsrv_open_cleanup()

Add and use smbXsrv_replay_cleanup() to delete replay cache records. Another
external caller comes later, hence adding this as a public function.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: make create-replay cache disk backed
Ralph Boehme [Sat, 26 Jul 2025 13:05:45 +0000 (15:05 +0200)] 
smbd: make create-replay cache disk backed

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agolibndr: add support for unions to ndr_pull_struct_blob_noalloc() and ndr_push_struct_...
Ralph Boehme [Fri, 11 Jul 2025 04:02:13 +0000 (06:02 +0200)] 
libndr: add support for unions to ndr_pull_struct_blob_noalloc() and ndr_push_struct_into_fixed_blob()

The union switch value is stored by ndr_token_store() which uses talloc to
manage ndr.switch_list. Preallocate a ndr_token array and ndr_token_list on the
stack of size ndr_token_list.fixed_alloc_count and optionally use that in
ndr_token_store().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: implement session check from MS-SMB2 3.3.5.9 Receiving an SMB2 CREATE Request
Ralph Boehme [Thu, 10 Jul 2025 14:48:22 +0000 (16:48 +0200)] 
smbd: implement session check from MS-SMB2 3.3.5.9 Receiving an SMB2 CREATE Request

If the server implements the SMB 3.x dialect family and all of the following conditions are TRUE, the
server MUST look up an Open in GlobalOpenTable where Open.IsReplayEligible is TRUE and
Open.CreateGuid matches the CreateGuid in the SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2
create context and Open.ClientGuid matches the ClientGuid of the connection that received this
request:

...

If an Open is found, the server MUST perform the following:

...

If Open.Session.SessionId is not equal to the current Session.SessionId, the server MUST fail
the request with STATUS_DUPLICATE_OBJECTID.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: Add session_global_id and tcon_global_id to smbXsrv_open_global0
Ralph Boehme [Thu, 10 Jul 2025 11:10:42 +0000 (13:10 +0200)] 
smbd: Add session_global_id and tcon_global_id to smbXsrv_open_global0

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: add smbXsrv_tcon to smbXsrv_open
Ralph Boehme [Fri, 11 Jul 2025 04:49:54 +0000 (06:49 +0200)] 
smbd: add smbXsrv_tcon to smbXsrv_open

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: add smbXsrv_session to smbXsrv_open
Ralph Boehme [Sat, 28 Jun 2025 06:55:25 +0000 (08:55 +0200)] 
smbd: add smbXsrv_session to smbXsrv_open

From "MS-SMB2 3.3.1.10 Per Open":

  Open.Session: A reference to the authenticated session, as specified in section
  3.3.1.8, over which this open was performed. If the open is not attached to a
  session at this time, this value MUST be NULL.

Needed to implement:

  3.3.5.9 Receiving an SMB2 CREATE Request

  If the server implements the SMB 3.x dialect family and all of the following
  conditions are TRUE, the server MUST look up an Open in GlobalOpenTable where
  Open.IsReplayEligible is TRUE and Open.CreateGuid matches the CreateGuid in
  the SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 create context and Open.ClientGuid
  matches the ClientGuid of the connection that received this request:

  ...

  If an Open is found, the server MUST perform the following:

  ..

  If Open.Session.SessionId is not equal to the current Session.SessionId, the
  server MUST fail the request with STATUS_DUPLICATE_OBJECTID.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: add and use smbXsrv_open_replay_cache_key_buf
Ralph Boehme [Sat, 26 Jul 2025 12:49:10 +0000 (14:49 +0200)] 
smbd: add and use smbXsrv_open_replay_cache_key_buf

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: make the replay cache record an index on the global open table
Ralph Boehme [Thu, 10 Jul 2025 14:31:16 +0000 (16:31 +0200)] 
smbd: make the replay cache record an index on the global open table

Store only the open_global record key as is in the replay-cache record, making
it an index into the global open table. Then in the replay code, use the new
function smbXsrv_open_global_lookup() to get at the open records.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: invert logic when handling pending create in smb2srv_open_lookup_replay_cache()
Ralph Boehme [Sat, 12 Jul 2025 06:27:38 +0000 (08:27 +0200)] 
smbd: invert logic when handling pending create in smb2srv_open_lookup_replay_cache()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: move create_action to smbXsrv_open_global0
Ralph Boehme [Thu, 10 Jul 2025 13:51:12 +0000 (15:51 +0200)] 
smbd: move create_action to smbXsrv_open_global0

In preperation for making create replay disk backed.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: simplify create-replay
Ralph Boehme [Thu, 10 Jul 2025 13:33:48 +0000 (15:33 +0200)] 
smbd: simplify create-replay

Just check state->open_was_deferred and skip calling
smb2srv_open_lookup_replay_cache() if it is set.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: move DH2Q context processing to its own function
Ralph Boehme [Thu, 10 Jul 2025 12:38:53 +0000 (14:38 +0200)] 
smbd: move DH2Q context processing to its own function

The DH2Q processing code is getting a bit bloated, move it to it's own
function. This also simplifies a coming change where I'll add an early out.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: add some debugging to smbXsrv_open_[lookup|set]_replay_cache()
Ralph Boehme [Sat, 14 Jun 2025 17:13:44 +0000 (19:13 +0200)] 
smbd: add some debugging to smbXsrv_open_[lookup|set]_replay_cache()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: move create_action handling to smbd_smb2_create_after_exec()
Ralph Boehme [Sat, 14 Jun 2025 13:41:38 +0000 (15:41 +0200)] 
smbd: move create_action handling to smbd_smb2_create_after_exec()

This ensures op->create_action is set when we're calling smbXsrv_open_update()
and fixes create_action handling for create replays.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: simplify create_action handling
Ralph Boehme [Tue, 8 Jul 2025 12:47:24 +0000 (14:47 +0200)] 
smbd: simplify create_action handling

(state->info == FILE_WAS_OVERWRITTEN) can only happen when returning
SMB_VFS_CREATE_FILE(), not for a Durable Handle reconnect or Replay, hence we
can move the check and adjustment of state->info to smbd_smb2_create_send()
after the call to SMB_VFS_CREATE_FILE().

This nicely simplifies the logic in smbd_smb2_create_finish() where we can now
just set state->op->create_action and state->out_create_action to the value of
state->info.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbtorture: add test smb2.replay.replay-twice-durable
Ralph Boehme [Mon, 30 Jun 2025 14:45:35 +0000 (16:45 +0200)] 
smbtorture: add test smb2.replay.replay-twice-durable

This verifies a second replay on a durable handle, after the handle has
already been used, is "ignored" and handled as a normal open.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbtorture: add test smb2.replay.durable-reconnect-replay3
Ralph Boehme [Mon, 30 Jun 2025 10:17:24 +0000 (12:17 +0200)] 
smbtorture: add test smb2.replay.durable-reconnect-replay3

This verifies a CREATE replay on a second connection with previous_session_id
set is working correctly.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbtorture: add test smb2.replay.durable-reconnect-replay2
Ralph Boehme [Mon, 30 Jun 2025 08:19:14 +0000 (10:19 +0200)] 
smbtorture: add test smb2.replay.durable-reconnect-replay2

This verifies a replay on a new connection with a new sesssion fails
with NT_STATUS_DUPLICATE_OBJECTID.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbtorture: add test smb2.replay.durable-reconnect-replay1
Ralph Boehme [Tue, 17 Jun 2025 15:56:07 +0000 (17:56 +0200)] 
smbtorture: add test smb2.replay.durable-reconnect-replay1

This verifies CREATE replay is working on a new connection.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agosmbd: fix include order in smbXsrv_open.c
Ralph Boehme [Tue, 17 Jun 2025 14:26:46 +0000 (16:26 +0200)] 
smbd: fix include order in smbXsrv_open.c

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agos3/dbwrap_watch: avoid leaking backend db handle in traverses
Ralph Boehme [Mon, 23 Jun 2025 08:17:32 +0000 (10:17 +0200)] 
s3/dbwrap_watch: avoid leaking backend db handle in traverses

Currently in a traverse callback dbwrap_record_get_db() returns the backend db
handle.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 days agos3:utils: Allow ROLE_IPA_DC to allow to use Kerberos in gensec
Pavel Filipenský [Mon, 4 Aug 2025 21:28:24 +0000 (23:28 +0200)] 
s3:utils: Allow ROLE_IPA_DC to allow to use Kerberos in gensec

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Aug  5 14:51:51 UTC 2025 on atb-devel-224

4 days agos3:netlogon: IPA DC is the PDC as well - allow ROLE_IPA_DC in _netr_DsRGetForestTrust...
Pavel Filipenský [Mon, 4 Aug 2025 21:26:02 +0000 (23:26 +0200)] 
s3:netlogon: IPA DC is the PDC as well - allow ROLE_IPA_DC in _netr_DsRGetForestTrustInformation()

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agodocs-xml: Make smb.conf 'server role' value consistent with ROLE_IPA_DC in libparam
Pavel Filipenský [Mon, 4 Aug 2025 06:35:29 +0000 (08:35 +0200)] 
docs-xml: Make smb.conf 'server role' value consistent with ROLE_IPA_DC in libparam

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 days agos3:winbindd: Resolve dc name using CLDAP also for ROLE_IPA_DC
Pavel Filipenský [Wed, 23 Jul 2025 13:09:21 +0000 (15:09 +0200)] 
s3:winbindd: Resolve dc name using CLDAP also for ROLE_IPA_DC

server role ROLE_IPA_DC (introduced in e2d5b4d) needs special handling
in dcip_check_name().  We should resolve the DC name using:
- CLDAP in dcip_check_name_ads()
instead of:
- NETBIOS in nbt_getdc() that fails if Windows is not providing netbios.

The impacted environment has:

domain->alt_name = example.com
domain->active_directory = 1
security = USER
server role = ROLE_IPA_DC

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Pair-programmed-with: Andreas Schneider <asn@samba.org>

Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 days agos3:tests: Use bash and disable history expansion for test_wbinfo_lookuprids_cache.sh
Andreas Schneider [Tue, 5 Aug 2025 09:31:59 +0000 (11:31 +0200)] 
s3:tests: Use bash and disable history expansion for test_wbinfo_lookuprids_cache.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Aug  5 12:50:07 UTC 2025 on atb-devel-224

4 days agos3:tests: Fix shellcheck warning of test_wbinfo_lookuprids_cache.sh
Andreas Schneider [Tue, 5 Aug 2025 09:11:10 +0000 (11:11 +0200)] 
s3:tests: Fix shellcheck warning of test_wbinfo_lookuprids_cache.sh

In source3/script/tests/test_wbinfo_lookuprids_cache.sh line 27:
key=$("$TDBDUMP" "$cache" | grep ^key.*NDR.*/"$opnum"/ | cut -d\" -f2)
                                 ^-------------------^ SC2062 (warning):
                                 Quote the grep pattern so the shell won't
                                 interpret it.

Lets better use awk for matching the pattern.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 days agodocs-xml: Update documentation for --use-kerberos and --use-krb5-ccache
Andreas Schneider [Tue, 5 Aug 2025 07:15:43 +0000 (09:15 +0200)] 
docs-xml: Update documentation for --use-kerberos and --use-krb5-ccache

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Aug  5 11:49:35 UTC 2025 on atb-devel-224

4 days agolib:cmdline: Check if we have a valid default ccache
Andreas Schneider [Fri, 25 Apr 2025 15:32:16 +0000 (17:32 +0200)] 
lib:cmdline: Check if we have a valid default ccache

If you don't specify anything, and we have a valid ccache then try to
use it!

> smbclient -L //samba1.earth.milkyway.site
Anonymous login successful

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        IPC$            IPC       IPC Service (Samba 4.22.1)
SMB1 disabled -- no workgroup available

In case the user specifies a principal, it will ask for a password:

> bin/smbclient -L //samba1.earth.milkyway.site -Ualice1@EARTH.MILKYWAY.SITE
Password for [alice1@EARTH.MILKYWAY.SITE]:

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 days agolibrpc:gse: Implement storing tickets into an emtpy ccache
Andreas Schneider [Fri, 4 Apr 2025 11:37:21 +0000 (13:37 +0200)] 
librpc:gse: Implement storing tickets into an emtpy ccache

smbclient //server/share --krb5-use-ccache=/tmp/foo

Will write the ticket to the specified ccache.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 days agoauth:creds: Add cli_credentials_get_out_ccache_name()
Andreas Schneider [Fri, 4 Apr 2025 11:33:19 +0000 (13:33 +0200)] 
auth:creds: Add cli_credentials_get_out_ccache_name()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 days agoauth:creds: Always store the ccache name
Andreas Schneider [Fri, 4 Apr 2025 11:32:41 +0000 (13:32 +0200)] 
auth:creds: Always store the ccache name

This will allow us to specify the cache as one to fill with credentials.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 days agoauth:creds: Make sure when parsing username that realm is uppercase
Andreas Schneider [Fri, 25 Apr 2025 09:30:14 +0000 (11:30 +0200)] 
auth:creds: Make sure when parsing username that realm is uppercase

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
4 days agosource3/printing: Fix CID 1273086 - Resource Leak
Shwetha K Acharya [Thu, 31 Jul 2025 12:59:05 +0000 (18:29 +0530)] 
source3/printing: Fix CID 1273086 - Resource Leak

Ensure print_queue_struct *q is initialized to NULL to avoid
undefined behavior when freeing on error paths. Move SAFE_FREE(q)
outside the ret > 0 block to ensure q is always freed.

Signed-off-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Aug  5 09:20:17 UTC 2025 on atb-devel-224

4 days agocoverity: Add some additional check for strequal()
Andreas Schneider [Tue, 29 Jul 2025 12:44:50 +0000 (14:44 +0200)] 
coverity: Add some additional check for strequal()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Aug  5 07:09:04 UTC 2025 on atb-devel-224

4 days agocoverity: Update README.md
Andreas Schneider [Fri, 3 Feb 2023 10:30:34 +0000 (11:30 +0100)] 
coverity: Update README.md

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
4 days agocoverity: Rename README to README.md
Andreas Schneider [Fri, 3 Feb 2023 10:22:40 +0000 (11:22 +0100)] 
coverity: Rename README to README.md

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
4 days agocoverity: Add makefile to build/test the modelling file
Andreas Schneider [Fri, 3 Feb 2023 10:20:17 +0000 (11:20 +0100)] 
coverity: Add makefile to build/test the modelling file

This allows to check that it compiles at least with gcc.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
4 days agocoverity: Add some documentation for the modelling file
Andreas Schneider [Thu, 2 Feb 2023 16:27:01 +0000 (17:27 +0100)] 
coverity: Add some documentation for the modelling file

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
4 days agogitlab-ci: Update build instructions for Coverity
Andreas Schneider [Tue, 29 Jul 2025 13:59:08 +0000 (15:59 +0200)] 
gitlab-ci: Update build instructions for Coverity

See https://scan.coverity.com/download?tab=other

ref: https://documentation.blackduck.com/bundle/coverity-docs/page/cli/topics/command_reference.html
ref: https://documentation.blackduck.com/bundle/coverity-docs/page/cli/topics/options_reference.html

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
7 days agolib/tdb: let tdbtool return error on failure
Günther Deschner [Wed, 30 Jul 2025 16:54:20 +0000 (18:54 +0200)] 
lib/tdb: let tdbtool return error on failure

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

Unless there is a striking reason not to do so tdbtool should return a
non-zero return code when a failure was encountered. Most known callers
have to parse stdout to check whether a command has succeeded or failed.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Sat Aug  2 08:20:53 UTC 2025 on atb-devel-224

7 days agos3-selftest: fix test_wbinfo_lookuprids_cache.sh
Günther Deschner [Thu, 31 Jul 2025 13:35:04 +0000 (15:35 +0200)] 
s3-selftest: fix test_wbinfo_lookuprids_cache.sh

This script is using tdbtool for deleting keys of a particular
winbind NDR operation for regression testing. There are two issues here:

The opnum for this winbind NDR operation has changed (as new calls have
been added to the interface), it is no longer 16 but now 17. Better try
to lookup the current opnum from the IDL.

As tdbtool always returns with success error code regardless of the
success of its command - in this case a delete key operation - the test
is simply not able to fail at all (patch following to fix tdbtool
itself).

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
8 days agolibrpc:ndr:keycredlink fix CID 1660828
Gary Lockyer [Thu, 31 Jul 2025 19:58:52 +0000 (07:58 +1200)] 
librpc:ndr:keycredlink fix CID 1660828

Fixes:

*** CID 1660828:         Control flow issues  (UNREACHABLE)
/librpc/ndr/ndr_keycredlink.c: 752             in pull_DER_RSA_KEY()
746      goto out;
747      }
748      if (!asn1_end_tag(asn)) { /* PublicKeyInfo */
749      return ndr_pull_error(ndr,
750            NDR_ERR_UNREAD_BYTES,
751            "ASN1 element PublicKeyInfo");
>>>     CID 1660828:         Control flow issues  (UNREACHABLE)
>>>     This code cannot be reached: "goto out;".
752      goto out;
753      }

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Aug  1 14:21:17 UTC 2025 on atb-devel-224

8 days agos3:smbd: Fix CID 1449599 replacing memcpy to memmove to avoid overflow
Shweta Sodani [Fri, 1 Aug 2025 06:15:52 +0000 (11:45 +0530)] 
s3:smbd: Fix CID 1449599 replacing memcpy to memmove to avoid overflow

Here reply_smb1_outbuf is allocating the req->outbuf buffer, hence
safest way to use is memmove that has a checks for overlap instead of
memcpy.

This fixes coverity issue#1449599

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Aug  1 11:03:06 UTC 2025 on atb-devel-224

9 days agolibrpc:bcrypt_rsakey_blob: exponent and modulus lengths can't be zero
Douglas Bagnall [Wed, 30 Jul 2025 09:18:09 +0000 (21:18 +1200)] 
librpc:bcrypt_rsakey_blob: exponent and modulus lengths can't be zero

Apart from it making no sense, without these ranges we end up
allocating a NULL buffer and aborting.

We also put a maximum size on the RSA key, in case we could get
tricked into a DoS by pulling a large buffer and trying crypto maths
on it.

 6 0x572ebce2749a in talloc_abort samba/lib/talloc/talloc.c:506:3
 7 0x572ebce271d4 in talloc_chunk_from_ptr samba/lib/talloc/talloc.c:0
 8 0x572ebce271d4 in __talloc_with_prefix samba/lib/talloc/talloc.c:762:12
 9 0x572ebce235f9 in __talloc samba/lib/talloc/talloc.c:825:9
10 0x572ebce235f9 in _talloc_named_const samba/lib/talloc/talloc.c:982:8
11 0x572ebce235f9 in _talloc_memdup samba/lib/talloc/talloc.c:2441:9
12 0x572ebc8f6a4f in data_blob_talloc_named samba/lib/util/data_blob.c:56:25
13 0x572ebc7d23bd in pull_BCRYPT_RSAPUBLIC_BLOB samba/librpc/ndr/ndr_keycredlink.c:878:17
14 0x572ebc7d23bd in ndr_pull_KeyMaterialInternal samba/librpc/ndr/ndr_keycredlink.c:959:10
15 0x572ebc788e90 in LLVMFuzzerTestOneInput samba/bin/default/lib/fuzzing/fuzz_ndr_keycredlink_TYPE_STRUCT.c:282:13

REF: https://issues.oss-fuzz.com/issues/435039896

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Jul 31 05:45:07 UTC 2025 on atb-devel-224

10 days agos3/libsmb: check the negative-conn-cache in resolve_ads()
Ralph Boehme [Thu, 3 Jul 2025 16:42:04 +0000 (18:42 +0200)] 
s3/libsmb: check the negative-conn-cache in resolve_ads()

This way we throw away blacklisted servers right away when learning about them
from the DNS SRV query.

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

Signed-off-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): Wed Jul 30 10:10:21 UTC 2025 on atb-devel-224

10 days agos3/libsmb: check command in make_dc_info_from_cldap_reply()
Ralph Boehme [Wed, 2 Jul 2025 16:49:51 +0000 (18:49 +0200)] 
s3/libsmb: check command in make_dc_info_from_cldap_reply()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agolibads: check for if DCs are in paused state when processing CLDAP replies
Ralph Boehme [Thu, 3 Jul 2025 10:50:53 +0000 (12:50 +0200)] 
libads: check for if DCs are in paused state when processing CLDAP replies

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agos3/libads: get rid of additional loop calling add_failed_connection_entry()
Ralph Boehme [Tue, 1 Jul 2025 16:19:32 +0000 (18:19 +0200)] 
s3/libads: get rid of additional loop calling add_failed_connection_entry()

Just call add_failed_connection_entry() in the initial loop at all places where
we have a "bad" result.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agos3:libads: let get_kdc_ip_string() check for a blacklisted server name
Stefan Metzmacher [Tue, 4 Jul 2023 16:07:51 +0000 (18:07 +0200)] 
s3:libads: let get_kdc_ip_string() check for a blacklisted server name

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agos3:libads: let cldap_ping_list() check for a blacklisted server name
Stefan Metzmacher [Wed, 16 Feb 2022 12:09:14 +0000 (13:09 +0100)] 
s3:libads: let cldap_ping_list() check for a blacklisted server name

If we black listed a server we should not use it even if
it responses to CLDAP requests.

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

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agowinbindd: blacklist servers returning ACCESS_DENIED/authoritative=0
Stefan Metzmacher [Wed, 16 Feb 2022 13:23:16 +0000 (14:23 +0100)] 
winbindd: blacklist servers returning ACCESS_DENIED/authoritative=0

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agowinbindd: always use winbind_add_failed_connection_entry() wrapper
Stefan Metzmacher [Wed, 16 Feb 2022 13:18:50 +0000 (14:18 +0100)] 
winbindd: always use winbind_add_failed_connection_entry() wrapper

We should not use add_failed_connection_entry() directly.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 days agos3:conncache: improve debugging for the negative connection cache
Stefan Metzmacher [Wed, 16 Feb 2022 13:18:20 +0000 (14:18 +0100)] 
s3:conncache: improve debugging for the negative connection cache

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
11 days agodsdb: fix bug 15872, use-after-free
Douglas Bagnall [Sun, 22 Jun 2025 03:05:39 +0000 (15:05 +1200)] 
dsdb: fix bug 15872, use-after-free

We were finding the old element, reallocing, then copying,
which is the wrong order.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Jul 30 02:03:40 UTC 2025 on atb-devel-224

11 days agoiconv: fixed coverity issue CID1609382
Xavi Hernandez [Tue, 29 Jul 2025 08:31:45 +0000 (10:31 +0200)] 
iconv: fixed coverity issue CID1609382

The issue is not a real bug as it is implemented, but it's better to not
mix signed and unsigned types to avoid potential future issues.

Signed-off-by: Xavi Hernandez <xhernandez@gmail.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Jul 30 00:44:28 UTC 2025 on atb-devel-224

11 days agos3:lib: Fix CID 1497484 use-after-free.
Vinit Agnihotri [Tue, 29 Jul 2025 05:02:06 +0000 (10:32 +0530)] 
s3:lib: Fix CID 1497484 use-after-free.

p was not set to NULL after being free'd, this can cause a
use-after-free situation.

This fixes coverity issue#1497484

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jul 29 15:01:42 UTC 2025 on atb-devel-224

11 days agos4:kdc Support for key trust authentication
Gary Lockyer [Fri, 25 Jul 2025 01:22:27 +0000 (13:22 +1200)] 
s4:kdc Support for key trust authentication

Extract the public kes from msDS-KeyCredentialLink and populate the sdb
structure.  These values can then be passed to Kergeros to allow key
trust authentication.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Jul 29 05:31:10 UTC 2025 on atb-devel-224

11 days agos4:kdc:sdb: Add support for key trust public keys
Gary Lockyer [Thu, 17 Jul 2025 02:12:08 +0000 (14:12 +1200)] 
s4:kdc:sdb: Add support for key trust public keys

Add public keys to the sdb entry to allow them to be passed to Kerberos
for key trust authentication.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
11 days agos4:kdc: Fix clang-tidy error in db-glue.c
Gary Lockyer [Wed, 16 Jul 2025 23:47:39 +0000 (11:47 +1200)] 
s4:kdc: Fix clang-tidy error in db-glue.c

../../source4/kdc/db-glue.c:968:14: warning: Access to field 'kvno' results in a dereference of a null pointer (loaded from variable 'entry') [clang-analyzer-core.NullDereference]
  968 |         entry->kvno = returned_kvno;
      |         ~~~~~       ^
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
11 days agolibrpc: keycredlink support X509 public keys
Gary Lockyer [Fri, 11 Jul 2025 01:41:42 +0000 (13:41 +1200)] 
librpc: keycredlink support X509 public keys

Add support for X509 encoded public keys in msDSKeyCredentialLink
KeyMaterial.

Note: Only RSA public keys are supported.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
11 days agolibrpc/idl: Add idl for tpm20_rsakey_blob
Gary Lockyer [Mon, 30 Jun 2025 21:43:07 +0000 (09:43 +1200)] 
librpc/idl: Add idl for tpm20_rsakey_blob

Idl and tests for TPM20_RSAKEY_BLOB, one of the possible encoding of
msDSKeyCredentialLink KeyMaterial
Derived from:
    https://dox.ipxe.org/Tpm20_8h_source.html#l00164
    https://stackoverflow.com/questions/78958315/cannot-parse-tpm2-0-public-key

Note: this is a greatly simplified implementation that only handles TPM
      version 2, RSA public keys.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
11 days agolibrpc/idl: update keycredlink comments
Gary Lockyer [Mon, 23 Jun 2025 22:45:58 +0000 (10:45 +1200)] 
librpc/idl: update keycredlink comments

Replace // comments with /* */ and document the KeyId and KeyHash
elements.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
11 days agolibrpc/idl: Add idl for BCRYPT_RSAKEY_BLOB
Gary Lockyer [Mon, 23 Jun 2025 03:01:37 +0000 (15:01 +1200)] 
librpc/idl: Add idl for BCRYPT_RSAKEY_BLOB

Idl and tests for BCRYPT_RSAKEY_BLOB
See https://learn.microsoft.com/en-us/windows/win32/api/
            bcrypt/ns-bcrypt-bcrypt_rsakey_blob

This is one of the encodings of msDSKeyCredentialLink KeyMaterial when
KeyUsage is KEY_USAGE_NGC. As there appears to be no official
documentation on the contents of KeyMaterial have based this on.

    https://github.com/p0dalirius/pydsinternals/blob/271dd969e07a8939044bfc498d94443082ec6fa9/
            dsinternals/common/data/hello/KeyCredential.py#L75-L92

Note: only RSA public keys are handled

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
12 days agoctdb-tests: Fix CID 1659221 - Error handling issues (CHECKED_RETURN)
Martin Schwenke [Sat, 26 Jul 2025 02:22:55 +0000 (12:22 +1000)] 
ctdb-tests: Fix CID 1659221 - Error handling issues (CHECKED_RETURN)

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Jul 28 06:45:51 UTC 2025 on atb-devel-224

12 days agoctdb-tcp: Fix CID 1291643 - Resource leak (RESOURCE_LEAK)
Martin Schwenke [Sun, 1 Jun 2025 01:05:31 +0000 (11:05 +1000)] 
ctdb-tcp: Fix CID 1291643 - Resource leak (RESOURCE_LEAK)

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
12 days agoctdb-tests: Fix CID 1373387 - Time of check time of use (TOCTOU)
Martin Schwenke [Fri, 7 Oct 2016 03:30:19 +0000 (14:30 +1100)] 
ctdb-tests: Fix CID 1373387 - Time of check time of use (TOCTOU)

Coverity doesn't like the fopen(3) after stat(2).  This is test code
that runs in a simple test environment, so this doesn't really matter.

However, reorder the code to put the stat(2) after the fopen(3).  This
means that the test still does all the same checks and it should now
make Coverity happy.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Anoop C S <anoopcs@samba.org>
2 weeks agogitignore: remove clang-format
Gary Lockyer [Thu, 24 Jul 2025 23:24:37 +0000 (11:24 +1200)] 
gitignore: remove clang-format

As we do have a project blessed clang-format, it should not be in
gitignore

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat Jul 26 06:02:34 UTC 2025 on atb-devel-224

2 weeks agos3-net: fix "net ads kerberos" krb5ccname handling
Günther Deschner [Sun, 20 Jul 2025 16:00:22 +0000 (18:00 +0200)] 
s3-net: fix "net ads kerberos" krb5ccname handling

We can only rely on KRB5CCNAME being set, --use-krb5-ccname content is
not available.

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Jul 24 17:31:14 UTC 2025 on atb-devel-224

2 weeks agos3-selftest: add tests for "net ads kerberos" commands
Günther Deschner [Sun, 20 Jul 2025 15:59:37 +0000 (17:59 +0200)] 
s3-selftest: add tests for "net ads kerberos" commands

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 weeks agoctdb-server: Load optional tunables.d/ directory
Martin Schwenke [Wed, 25 Jun 2025 12:18:16 +0000 (22:18 +1000)] 
ctdb-server: Load optional tunables.d/ directory

Change the variable name to "path" so it makes sense to reuse it for
the directory.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Jul 23 00:02:47 UTC 2025 on atb-devel-224

2 weeks agoctdb-server: Whitespace fixes
Martin Schwenke [Wed, 25 Jun 2025 12:21:39 +0000 (22:21 +1000)] 
ctdb-server: Whitespace fixes

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Add tests for tunables directory loading
Martin Schwenke [Fri, 27 Jun 2025 07:35:03 +0000 (17:35 +1000)] 
ctdb-tests: Add tests for tunables directory loading

The missing 2nd file testcase becomes the missing directory testcase,
because you can't easily have both.  See the comment in
tunable_test.c.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-common: Add tunable directory loading
Martin Schwenke [Fri, 27 Jun 2025 05:11:59 +0000 (15:11 +1000)] 
ctdb-common: Add tunable directory loading

This is simpler than include files and more general than just allowing
a 2nd file to be loaded.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Allow tunables unit test to process a second file
Martin Schwenke [Wed, 25 Jun 2025 12:14:05 +0000 (22:14 +1000)] 
ctdb-tests: Allow tunables unit test to process a second file

The second file is optional.

Make $tfile the default to avoid having to update all of the single
file testcases.

Add test cases for second file.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-common: Log tunables filename instead of function name
Martin Schwenke [Fri, 27 Jun 2025 05:05:04 +0000 (15:05 +1000)] 
ctdb-common: Log tunables filename instead of function name

When loading multiple files, this is more informative.

Tweak a couple of error messages to ensure they all mention
"tunables".

Update the unit testcases to match.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-common: Log a message if the tunables file does not exist
Martin Schwenke [Sun, 29 Jun 2025 00:16:20 +0000 (10:16 +1000)] 
ctdb-common: Log a message if the tunables file does not exist

Switch the unit test script to INFO debug level to ensure this output
appears when expected.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Add logging support to the tunables unit test
Martin Schwenke [Sat, 28 Jun 2025 02:01:41 +0000 (12:01 +1000)] 
ctdb-tests: Add logging support to the tunables unit test

Make tunable_test respect CTDB_DEBUGLEVEL.  Using test_options.[ch]
would be overkill here.  This means including logging.c - we can't
link to the subsystem containing logging.c because the file being
tested (tunable.c) is part of that subsystem.

Support logging in the test script.  tunable_ok() builds the logging
output for the good path.  Set the debug level to NOTICE and update
expected results for individual failure path tests.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-common: Require separate initialisation of tunable defaults
Martin Schwenke [Wed, 25 Jun 2025 10:46:26 +0000 (20:46 +1000)] 
ctdb-common: Require separate initialisation of tunable defaults

Dropping this from ctdb_tunable_load_file() allows that function to be
called multiple times for different files.  The caller sets the
defaults.

In the test script, factor out the handling of a single tunables file
in a similar way.  Ignoring missing/unreadable files is OK because
this function will only be called for test successes (hence "ok" in
the name).  There will never be existing, unreadable files.  The code
being tested ignores missing files, so do that here too.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-tests: Reformat with "shfmt -w -p -i 0 -fn"
Martin Schwenke [Sat, 28 Jun 2025 02:12:33 +0000 (12:12 +1000)] 
ctdb-tests: Reformat with "shfmt -w -p -i 0 -fn"

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agoctdb-common: Fix includes to make file standalone
Martin Schwenke [Wed, 25 Jun 2025 10:44:52 +0000 (20:44 +1000)] 
ctdb-common: Fix includes to make file standalone

Avoid lots of red underlines in my editor.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 weeks agolibcli/smb: use talloc_asprintf_addbuf() in smbXcli_session_dump_keys()
Ralph Boehme [Mon, 21 Jul 2025 10:59:55 +0000 (12:59 +0200)] 
libcli/smb: use talloc_asprintf_addbuf() in smbXcli_session_dump_keys()

Avoids DEBUGADD() which can lead to intersected output in the logfile.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jul 22 15:09:11 UTC 2025 on atb-devel-224