]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 months agoauth:creds: Keep password secret in cmdline_get_userpassword()
Andreas Schneider [Thu, 7 Aug 2025 11:48:04 +0000 (13:48 +0200)] 
auth:creds: Keep password secret in cmdline_get_userpassword()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 34482f4ad014a09c84b484097a8d03dfec4f6512)

2 months agoauth:creds: Keep the password secret
Andreas Schneider [Thu, 7 Aug 2025 11:45:48 +0000 (13:45 +0200)] 
auth:creds: Keep the password secret

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 705db6c8b295f65f40b7dcd0d5dc0f6db901c8d7)

2 months agoauth:creds: Allow to reset the principal by passing NULL to set_principal
Andreas Schneider [Wed, 6 Aug 2025 12:42:51 +0000 (14:42 +0200)] 
auth:creds: Allow to reset the principal by passing NULL to set_principal

We do that e.g. in cli_credentials_set_anonymous()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 67c2feba290764c62ab01602d5bc9d4d122c2c12)

2 months agoauth:creds: Also uppercase realm set via a callback
Andreas Schneider [Thu, 7 Aug 2025 11:32:47 +0000 (13:32 +0200)] 
auth:creds: Also uppercase realm set via a callback

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 4f8ff3a567d6318c71b0960345592224721c9594)

2 months agoauth:creds: Allow to reset the realm by passing NULL
Andreas Schneider [Wed, 6 Aug 2025 12:40:34 +0000 (14:40 +0200)] 
auth:creds: Allow to reset the realm by passing NULL

This is e.g. done by cli_credentials_set_anonymous().

We can't call TALLOC_FREE(cred->realm), as this would break
cli_credentials_shallow_copy().

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit e5608cdb2e5a7ef2641ec0e7b0ce0b4640a02ce1)

2 months agosmbd: return correct reparse tag DFS when listing directories
Ralph Boehme [Fri, 15 Aug 2025 08:13:33 +0000 (10:13 +0200)] 
smbd: return correct reparse tag DFS when listing directories

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

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): Fri Aug 15 15:37:05 UTC 2025 on atb-devel-224

(cherry picked from commit 0be53d7ac0a39d6a48c6c5e2144f342c0d406781)

2 months agoCI: add Python test samba.tests.dcerpc.dfs.DfsTests.test_dfs_reparse_tag
Ralph Boehme [Thu, 14 Aug 2025 15:18:08 +0000 (17:18 +0200)] 
CI: add Python test samba.tests.dcerpc.dfs.DfsTests.test_dfs_reparse_tag

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 43ee86c0c757e95712ed52bd336d2085485498ba)

2 months agopython/tests: also populate self.server in calls LibsmbTests setup()
Ralph Boehme [Fri, 15 Aug 2025 09:49:27 +0000 (11:49 +0200)] 
python/tests: also populate self.server in calls LibsmbTests setup()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 5f7b31927733b0ff3e1207be242f1ddb2cb699bd)

2 months agopylibsmb: add SMB2_FIND_ID_BOTH_DIRECTORY_INFO
Ralph Boehme [Fri, 15 Aug 2025 08:14:53 +0000 (10:14 +0200)] 
pylibsmb: add SMB2_FIND_ID_BOTH_DIRECTORY_INFO

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 698a0195f72a091e9ed6b0448160c79e37761840)

2 months agovfs_xattr_tdb: fix dangling symlink detection
Ralph Boehme [Fri, 15 Aug 2025 09:50:26 +0000 (11:50 +0200)] 
vfs_xattr_tdb: fix dangling symlink detection

The caller might not have called stat on smb_fname.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 2e88ba4b4de146327c19682d59bbe34d68158bf7)

2 months agos3/rpc_server/dfs: fix creating a DFS link
Ralph Boehme [Thu, 14 Aug 2025 17:20:02 +0000 (19:20 +0200)] 
s3/rpc_server/dfs: fix creating a DFS link

If there's no existing link, get_referred_path() returns NT_STATUS_OBJECT_PATH_NOT_FOUND.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 2cb2991ccdd5d4f63e4c5b3ccc4454a6b39d6afe)

2 months agoVERSION: Bump version up to Samba 4.23.0rc3...
Jule Anger [Fri, 22 Aug 2025 15:31:25 +0000 (17:31 +0200)] 
VERSION: Bump version up to Samba 4.23.0rc3...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
2 months agoVERSION: Disable GIT_SNAPSHOT for the 4.23.0rc2 release. samba-4.23.0rc2
Jule Anger [Fri, 22 Aug 2025 15:30:46 +0000 (17:30 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the 4.23.0rc2 release.

Signed-off-by: Jule Anger <janger@samba.org>
2 months agoWHATSNEW: Add release notes for Samba 4.23.0rc2.
Jule Anger [Fri, 22 Aug 2025 15:30:02 +0000 (17:30 +0200)] 
WHATSNEW: Add release notes for Samba 4.23.0rc2.

Signed-off-by: Jule Anger <janger@samba.org>
2 months agoWHATSNEW: samba-tool domain backup --no-secrets changes
Douglas Bagnall [Wed, 20 Aug 2025 00:18:53 +0000 (12:18 +1200)] 
WHATSNEW: samba-tool domain backup --no-secrets changes

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 months agothird_party:quic_ko_wrapper Fix compilation with clang-20
Gary Lockyer [Thu, 14 Aug 2025 21:38:07 +0000 (09:38 +1200)] 
third_party:quic_ko_wrapper Fix compilation with clang-20

Rework the code to remove the non portable variable length array in the union.
Based on the code in wrap_msghdr_add_cmsghdr().

NOTE: this removes the 64 bit alignment, which I think should be ok.

./../third_party/quic_ko_wrapper/quic_ko_wrapper.c:3523:11: error:
   fields must have a constant size: 'variable length array in structure'
   extension will never be supported
  3523 |                 uint8_t cmbuf[cmspace];
       |                         ^
1 error generated.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Wed Aug 20 15:04:34 UTC 2025 on atb-devel-224

(cherry picked from commit 26065e1f1ee111f5ddfb64782638492af65aeb95)

Autobuild-User(v4-23-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-23-test): Fri Aug 22 13:11:45 UTC 2025 on atb-devel-224

2 months agothird_party:quic Fix compilation with clang-20
Gary Lockyer [Thu, 14 Aug 2025 21:33:24 +0000 (09:33 +1200)] 
third_party:quic Fix compilation with clang-20

Add -Wno-error=format-nonliteral so that quic builds with clang 20

../../third_party/quic/libquic/handshake.c:106:35: error:
   format string is not a string literal [-Werror,-Wformat-nonliteral]
  106 |         rc = vsnprintf(msg, sizeof(msg), fmt, arg);
      |                                          ^~~
../../third_party/quic/libquic/handshake.c:135:35: error:
   format string is not a string literal [-Werror,-Wformat-nonliteral]
  135 |         rc = vsnprintf(msg, sizeof(msg), fmt, arg);
      |                                          ^~~
../../third_party/quic/libquic/handshake.c:164:35: error:
   format string is not a string literal [-Werror,-Wformat-nonliteral]
  164 |         rc = vsnprintf(msg, sizeof(msg), fmt, arg);
      |                                          ^~~

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit de7932ea8d12348208f50f7b050b826d236ea597)

2 months agothird_party: fix libquic build on older systems
Björn Baumbach [Fri, 8 Aug 2025 15:31:34 +0000 (17:31 +0200)] 
third_party: fix libquic build on older systems

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

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 149933854f39b4628b14abc5dcd57e73e2a0a637)

2 months agolibads: change netlogon_pings() behaviour wrt to min_servers parameter
Ralph Boehme [Thu, 24 Jul 2025 10:59:30 +0000 (12:59 +0200)] 
libads: change netlogon_pings() behaviour wrt to min_servers parameter

Currently if a caller passes min_servers=X with X>1, netlogon_pings() will fail
if it can't contact X DCs. This is not really what we want. What we want is: we
want at least one DC, and up to X.

Change implemenentation in that sense and rename the min_servers argument to
wanted_servers to express this behaviour change.

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

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 Aug 13 19:31:10 UTC 2025 on atb-devel-224

(cherry picked from commit 85dd55a5fef0049660126bdcd48abfa1c48da259)

2 months agolibads: reverse termination condition in netlogon_pings_done()
Ralph Boehme [Thu, 24 Jul 2025 10:55:30 +0000 (12:55 +0200)] 
libads: reverse termination condition in netlogon_pings_done()

No change in behaviour, prepares for upcoming change and minimizes its diff.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 6643d1fb3375903e2857e5bff33b39a4562c5a4d)

2 months agoidmap_ad: add and use ldap_timeout and fix LDAP server failover
Ralph Boehme [Thu, 24 Jul 2025 13:49:19 +0000 (15:49 +0200)] 
idmap_ad: add and use ldap_timeout and fix LDAP server failover

The key parts are:

1. If an LDAP search fails with the hardcoded fatal error, remove the
retry. That would only retry the query against the same server, taken
from the DCINFO cache key. Instead, force a DC rediscovery.

2. Set a default ldap_timeout and pass it to tldap_search(). This
avoids tldap_search() hanging forever on a stale TCP connection.

3. The LDAP server idmap_ad is using is not necessarily the same DC
we're using for RPC, so in case we learn about a dead DC, put it in
the negative-conn-cache.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 4d69ec473b7be763399c9787eda8e659a1582184)

2 months agotldap: use tevent_req_set_endtime() to terminate LDAP searches
Ralph Boehme [Mon, 21 Jul 2025 04:44:22 +0000 (06:44 +0200)] 
tldap: use tevent_req_set_endtime() to terminate LDAP searches

Needed to detect unresponsive LDAP servers, otherwise we might be sitting up to
924.6 seconds after sending a request before the kernel notifies us of a broken
connection.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 4e79fe13325385ef4fe37baeec8656c9b332de19)

2 months agowinbindd: use find_domain_from_name_noinit() in find_dns_domain_name()
Ralph Boehme [Tue, 22 Jul 2025 17:16:14 +0000 (19:16 +0200)] 
winbindd: use find_domain_from_name_noinit() in find_dns_domain_name()

Avoid triggering a connection to a DC of a trusted domain.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 9ad2e59a464bb472da2071c61a254547b6497625)

2 months agolibads: fix get_kdc_ip_string()
Ralph Boehme [Tue, 22 Jul 2025 17:22:31 +0000 (19:22 +0200)] 
libads: fix get_kdc_ip_string()

Correctly handle the interaction between optionally passed in DC via
pss and DC lookup.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 23f100f67c0586a940e91e9e1e6f42b804401322)

2 months agoWHATSNEW: add Per-share profiling stats
Jule Anger [Wed, 13 Aug 2025 09:01:00 +0000 (11:01 +0200)] 
WHATSNEW: add Per-share profiling stats

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
2 months agoWHATSNEW: add CTDB changes
Jule Anger [Mon, 11 Aug 2025 06:52:10 +0000 (08:52 +0200)] 
WHATSNEW: add CTDB changes

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2 months agoVERSION: Bump version up to Samba 4.23.0rc2...
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 months agoVERSION: Disable GIT_SNAPSHOT for the Samba 4.23.0rc1 release. 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 months 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 months 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 months 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 months 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 months 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 months 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

2 months 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

2 months 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

2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
3 months 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

3 months 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>
3 months 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

3 months 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

3 months 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

3 months 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

3 months 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>
3 months 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>
3 months 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>
3 months 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>
3 months 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>
3 months 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>
3 months 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>
3 months 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>
3 months 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

3 months 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