]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
7 hours agos3-vfs_fruit: add 'fruit:veto_localized' option master
Günther Deschner [Mon, 24 Oct 2022 13:42:54 +0000 (15:42 +0200)] 
s3-vfs_fruit: add 'fruit:veto_localized' option

This new boolean option allows to automatically treat ".localized" as
vetoed files. Any attempts to access a ".localized" file or directory
will result in an access failure. MacOS tries to check for the presence
of such a file to check for the need of localized name display in
directory listings or checks for .localized directories containing name
translations).  In large directory listings, typically half of the
compound SMB2 queries are done for ".localized", causing a significant
performance impact in particular with clustered filesystems.

More information can be found here:
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemAdvancedPT/LocalizingtheNameofaDirectory/LocalizingtheNameofaDirectory.html

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Aug 14 11:08:11 UTC 2025 on atb-devel-224

12 hours agolib: docs: talloc: fix a wrong cd command gitlab/master
Michael Adam [Wed, 13 Aug 2025 11:05:23 +0000 (13:05 +0200)] 
lib: docs: talloc: fix a wrong cd command

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Aug 14 06:27:38 UTC 2025 on atb-devel-224

13 hours agolib:tdb: Remove obsolete web page
Andreas Schneider [Wed, 13 Aug 2025 14:38:10 +0000 (16:38 +0200)] 
lib:tdb: Remove obsolete web page

The current one is the doxygen generated one.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
13 hours agolib:talloc: Remove obsolete web page
Andreas Schneider [Wed, 13 Aug 2025 14:37:04 +0000 (16:37 +0200)] 
lib:talloc: Remove obsolete web page

The current one is the doxygen generated one.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
13 hours agocoverity: Fix running coverity in our pipeline
Andreas Schneider [Thu, 7 Aug 2025 14:14:43 +0000 (16:14 +0200)] 
coverity: Fix running coverity in our pipeline

It fails to run if it doesn't find this file. You need it if you run
Coverity locally.

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>
23 hours 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

24 hours 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>
24 hours 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>
24 hours 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>
24 hours 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>
24 hours 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>
24 hours agos4:torture/smb2: Fix torture test case smb2.acls.ACCESS_BASED
Vinit Agnihotri [Wed, 30 Jul 2025 04:46:05 +0000 (10:16 +0530)] 
s4:torture/smb2: Fix torture test case smb2.acls.ACCESS_BASED

Currently this test case fails to run against windows target, as
it is hardcoded to use sharename as "hideunread".

This change enables this test case to be executed against windows,
by omitting use of hideunread share and relevant flags.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Aug 13 18:29:53 UTC 2025 on atb-devel-224

25 hours agos4:torture/smb2: Mark smb2.acl.SDFLAGSVSCHOWN as not supported for windows
Vinit Agnihotri [Fri, 11 Jul 2025 12:39:58 +0000 (18:09 +0530)] 
s4:torture/smb2: Mark smb2.acl.SDFLAGSVSCHOWN as not supported for windows

Test case is expecting return code of NT_STATUS_OK for changing owner to
'everyone', however 'Windows 2016 server' is returning error code as
NT_STATUS_INVALID_OWNER and test case fails.

Same error code is returned if tested against targets w2k16, win2k12R2, win10, win11,
win7, win8 and winxp as well.

Thus marking this case as not supported for all windows versions till, issue is resolved.

Singed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
25 hours agos4:torture/smb2: Restore original sd for every test case finish
Vinit Agnihotri [Mon, 14 Jul 2025 08:10:02 +0000 (13:40 +0530)] 
s4:torture/smb2: Restore original sd for every test case finish

Some tests are not restoring original sd, at end of test.
This causes create test file to stay with incorrect access, resulting
into failure of smb2_deltree() to clear them up, which in-turn causes
other test cases to fail with 'object name collision' for mkdir test
directory.

Fix:
- Call setinfo on testfile with original sd.
- Fix some typos

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
25 hours agos4:torture: Add new target 'w2k16'
Vinit Agnihotri [Fri, 11 Jul 2025 12:39:08 +0000 (18:09 +0530)] 
s4:torture: Add new target 'w2k16'

This fix adds new target 'w2k16' which sets default value for option
'hide_on_access_denied' to true.

'windows 2016 server' returns NT_STATUS_OBJECT_NAME_NOT_FOUND on a createfile when
access is denied rather than NT_STATUS_ACCESS_DENIED. Above option
takes care of this behaviour.

Move TARGET_IS_WINDOWS to utils.h and add all presently defined windows
targets for the same.

Singed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
38 hours agothird_party:ngtcp2 Fix compilation with clang-20
Gary Lockyer [Tue, 12 Aug 2025 23:52:36 +0000 (11:52 +1200)] 
third_party:ngtcp2 Fix compilation with clang-20

Add -Wno-error=implicit-fallthrough and -Wno-error=format-nonliteral so that
ngtcp2 builds with clang 20

[1972/4994] Compiling third_party/ngtcp2/lib/ngtcp2_objalloc.c
../../third_party/ngtcp2/lib/ngtcp2_rtb.c:1120:7: error:
   unannotated fall-through between switch labels
   [-Werror,-Wimplicit-fallthrough]
   1120 |       case NGTCP2_ECN_STATE_UNKNOWN:
        |       ^
../../third_party/ngtcp2/lib/ngtcp2_rtb.c:1120:7: note:
   insert '__attribute__((fallthrough));' to silence this warning
   1120 |       case NGTCP2_ECN_STATE_UNKNOWN:
        |       ^
        |       __attribute__((fallthrough));
../../third_party/ngtcp2/lib/ngtcp2_rtb.c:1120:7: note:
   insert 'break;' to avoid fall-through
   1120 |       case NGTCP2_ECN_STATE_UNKNOWN:
        |       ^
        |       break;
1 error generated.

../../third_party/ngtcp2/lib/ngtcp2_log.c:818:35: error:
   format string is not a string literal [-Werror,-Wformat-nonliteral]
   818 |   n = vsnprintf(buf, sizeof(buf), fmt, ap);
       |                                   ^~~
1 error generated.

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 13 03:58:43 UTC 2025 on atb-devel-224

39 hours agopython:key_credential_link: old python compatibility
Douglas Bagnall [Tue, 12 Aug 2025 22:58:36 +0000 (10:58 +1200)] 
python:key_credential_link: old python compatibility

int.to_bytes assumed these defaults in recent versions

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
39 hours agopython:models: add key credential link DN to domain fields
Douglas Bagnall [Wed, 6 Aug 2025 02:00:55 +0000 (14:00 +1200)] 
python:models: add key credential link DN to domain fields

This will soon be needed by samba-tool, and is also going to be used
in some tests.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
40 hours agos3-utils: Fix CID #1517309 Resource leak in net offlinejoin code.
Günther Deschner [Tue, 12 Aug 2025 12:37:06 +0000 (14:37 +0200)] 
s3-utils: Fix CID #1517309 Resource leak in net offlinejoin code.

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): Wed Aug 13 01:51:11 UTC 2025 on atb-devel-224

42 hours agolibcli/smb: Fix CID #710784 Resource leak
Günther Deschner [Mon, 11 Aug 2025 14:58:51 +0000 (16:58 +0200)] 
libcli/smb: Fix CID #710784 Resource leak

buf was (re-)allocated on NULL context thus not part of frame that is
freed.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 days agolib/util: Fix CID 1414760 - Memory leak
Shweta Sodani [Mon, 4 Aug 2025 11:39:23 +0000 (17:09 +0530)] 
lib/util: Fix CID 1414760 - Memory leak

local variable 't' is reusing in child process, resulting the leaking
the tfork object as a side effect.

This fixes coverity issue#1414760

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Shachar Sharon <ssharon@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Aug 12 09:32:19 UTC 2025 on atb-devel-224

2 days agonsswitch: support all known DS lookup flags in wbclient's wbcLookupDomainController()
Günther Deschner [Mon, 14 Jul 2025 18:18:08 +0000 (20:18 +0200)] 
nsswitch: support all known DS lookup flags in wbclient's wbcLookupDomainController()

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): Tue Aug 12 08:26:55 UTC 2025 on atb-devel-224

2 days agovfs_default: Use already available SMBPROFILE_*_X macros
Anoop C S [Wed, 2 Jul 2025 09:36:17 +0000 (15:06 +0530)] 
vfs_default: Use already available SMBPROFILE_*_X macros

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2 days agovfs_ceph_new: Use already available SMBPROFILE_*_X macros
Anoop C S [Wed, 2 Jul 2025 09:34:27 +0000 (15:04 +0530)] 
vfs_ceph_new: Use already available SMBPROFILE_*_X macros

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2 days agos3/smbd: Use SMBPROFILE_IOBYTES_ASYNC_STATE_X macro
Anoop C S [Wed, 2 Jul 2025 09:42:20 +0000 (15:12 +0530)] 
s3/smbd: Use SMBPROFILE_IOBYTES_ASYNC_STATE_X macro

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2 days agos3/include: Define SMBPROFILE_*_ASYNC_STATE_X macros
Anoop C S [Wed, 2 Jul 2025 09:38:58 +0000 (15:08 +0530)] 
s3/include: Define SMBPROFILE_*_ASYNC_STATE_X macros

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2 days agocompression/tests: Fix possible out of bound access CID:1517301
Vinit Agnihotri [Fri, 8 Aug 2025 12:23:14 +0000 (17:53 +0530)] 
compression/tests: Fix possible out of bound access CID:1517301

This would fix additional coverity issue:1517285

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Aug 11 22:59:26 UTC 2025 on atb-devel-224

5 days agoutils: Fix memory leak CID:1499405
Vinit Agnihotri [Fri, 8 Aug 2025 13:17:57 +0000 (18:47 +0530)] 
utils: Fix memory leak CID:1499405

free memory allocated to status on error condition.

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Aug  9 07:37:05 UTC 2025 on atb-devel-224

6 days agovfs: Convert pread, pwrite and fsync recv interfaces to macros
Anoop C S [Fri, 11 Jul 2025 15:10:12 +0000 (20:40 +0530)] 
vfs: Convert pread, pwrite and fsync recv interfaces to macros

Following the common convention of using uppercase letters for macros,
convert SMB_VFS_PREAD_RECV, SMB_VFS_PWRITE_RECV and SMB_VFS_FSYNC_RECV
functions to equivalent macros.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Aug  8 13:04:52 UTC 2025 on atb-devel-224

6 days agosmbclient: fix handling errors from do_put in mput
Ralph Boehme [Wed, 30 Jul 2025 07:53:40 +0000 (09:53 +0200)] 
smbclient: fix handling errors from do_put in mput

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Aug  8 11:59:33 UTC 2025 on atb-devel-224

6 days agopython:ndr: improve type annotation and docs for pack/unpack
Douglas Bagnall [Wed, 9 Jul 2025 00:50:31 +0000 (12:50 +1200)] 
python:ndr: improve type annotation and docs for pack/unpack

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): Fri Aug  8 00:29:00 UTC 2025 on atb-devel-224

6 days agopython:samdb: remove dsdb_Dn alias
Douglas Bagnall [Wed, 30 Jul 2025 04:05:23 +0000 (16:05 +1200)] 
python:samdb: remove dsdb_Dn alias

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopy:samdb: add get_linearized to dsdb_dn
Douglas Bagnall [Wed, 30 Jul 2025 04:40:15 +0000 (16:40 +1200)] 
py:samdb: add get_linearized to dsdb_dn

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopy:samdb: drop unused methods (get_binary_integer, get_bytes)
Douglas Bagnall [Wed, 30 Jul 2025 02:51:32 +0000 (14:51 +1200)] 
py:samdb: drop unused methods (get_binary_integer, get_bytes)

get_binary_integer() is still a method on BinaryDn, but not on
StringDn and PlainDn where it makes no sense.

x.get_bytes() is merely an alias for x.binary.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytest:repl_rodc: avoid using dsdb_dn.get_bytes
Douglas Bagnall [Thu, 26 Jun 2025 01:13:31 +0000 (13:13 +1200)] 
pytest:repl_rodc: avoid using dsdb_dn.get_bytes

Nobody else uses it, so let's just use .binary.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytest: add key_credential_link_Dn tests
Douglas Bagnall [Fri, 11 Jul 2025 01:28:33 +0000 (13:28 +1200)] 
pytest: add key_credential_link_Dn tests

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopython: add helpers to construct KeyCredentialLinkDn objects
Douglas Bagnall [Wed, 30 Jul 2025 03:15:04 +0000 (15:15 +1200)] 
python: add helpers to construct KeyCredentialLinkDn objects

We want to ensure the as best we can that the binary blob is in a
useful format. This will be used by samba-tool.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopython: add KeyCredentialLinkDn BinaryDn subtype
Douglas Bagnall [Thu, 17 Jul 2025 00:02:10 +0000 (12:02 +1200)] 
python: add KeyCredentialLinkDn BinaryDn subtype

This works as a BinaryDn, but it also does validation to ensure the
binary contains a KEYCREDENTIALLINK_BLOB.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agosamba_kcc: log when msDS-HasInstantiatedNCs is not BinaryDn
Douglas Bagnall [Wed, 30 Jul 2025 02:28:22 +0000 (14:28 +1200)] 
samba_kcc: log when msDS-HasInstantiatedNCs is not BinaryDn

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agosamba_kcc: use dsdb_dn_guess()
Douglas Bagnall [Thu, 26 Jun 2025 00:46:14 +0000 (12:46 +1200)] 
samba_kcc: use dsdb_dn_guess()

We also remove a bit of .decode()ing, which now happens automatically.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agodbcheck: make deleted_objects check case-insensitive
Douglas Bagnall [Thu, 26 Jun 2025 00:45:24 +0000 (12:45 +1200)] 
dbcheck: make deleted_objects check case-insensitive

While a BinaryDn.prefix is generated in upper-case, and
dsdb.DS_GUID_DELETED_OBJECTS_CONTAINER is upper-case, we can avoid
having to think about that by comparing the actual bytes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agodbcheck: use new dsdb_dn types
Douglas Bagnall [Thu, 26 Jun 2025 00:42:54 +0000 (12:42 +1200)] 
dbcheck: use new dsdb_dn types

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytest:krb5_base: use BinaryDn not dsdb_dn
Douglas Bagnall [Wed, 25 Jun 2025 23:58:30 +0000 (11:58 +1200)] 
pytest:krb5_base: use BinaryDn not dsdb_dn

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agos4:pytest:repl_rodc: use BinaryDn not dsdb_dn
Douglas Bagnall [Wed, 25 Jun 2025 23:57:45 +0000 (11:57 +1200)] 
s4:pytest:repl_rodc: use BinaryDn not dsdb_dn

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytest:dsdb_dn: expand and rework tests
Douglas Bagnall [Thu, 26 Jun 2025 04:17:14 +0000 (16:17 +1200)] 
pytest:dsdb_dn: expand and rework tests

We now test the specialised StringDn and BinaryDn types.

There are new assertions about case-insensitivity in binary hex
strings and BinaryDn prefix validation.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytest:dsdb_dn: fix binary test
Douglas Bagnall [Wed, 30 Jul 2025 00:35:22 +0000 (12:35 +1200)] 
pytest:dsdb_dn: fix binary test

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopython:samdb: replace dsdb_Dn with stricter types
Douglas Bagnall [Thu, 19 Jun 2025 01:25:08 +0000 (13:25 +1200)] 
python:samdb: replace dsdb_Dn with stricter types

dsdb_Dn() was a catchall for DN+Binary, DN+String, and plain DNs which
needed to be sorted in a particular way. This meant it treated none of
them exactly right.

For example, a binary dsdb_Dn would be compared on the string
representation of the binary portion, so 'B:2:ff:CN=foo' would not
equal 'B:2:FF:CN=foo', when it should.

It meant a field that expected a binary dsdb_DN would also accept a
plain DN or a string DN, which is never actually allowed.

Also the parsing was a bit dodgy, so a string like 'B:6:ff:CN=foo'
would be accepted, when the length of the binary portion ("ff") is
obviously different from that given ("6").

Here we solve many of the problems by making stricter subclasses but
leaving a compatibility shim in place so that existing code continues
to work.

There is one INCOMPATIBLE change. Previously the `.binary` attribute
of a dsdb_Dn was the hex-string, while now it is the actual binary
data. In the case of StringDn, this means the utf-8 bytes.

This affects dbcheck, which is fixed here (the .prefix assignment now
correctly sets .binary).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopy/common: add cmp_with_nones() helper function
Douglas Bagnall [Wed, 16 Jul 2025 23:42:54 +0000 (11:42 +1200)] 
py/common: add cmp_with_nones() helper function

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopy:common: normalise_int32 checks bit size
Douglas Bagnall [Tue, 29 Jul 2025 23:57:02 +0000 (11:57 +1200)] 
py:common: normalise_int32 checks bit size

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytests: test normalise_int32 against out-of-range numbers
Douglas Bagnall [Thu, 26 Jun 2025 04:30:48 +0000 (16:30 +1200)] 
pytests: test normalise_int32 against out-of-range numbers

For example, we don't want to "normalise" 0x9876543210 to
0x9776543210, or 0x200000000 to 0x100000000. That is just causing
random damage to 64 bit values without achieving the sign switch.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
6 days agopytests: move dsdb_dn tests out of common
Douglas Bagnall [Thu, 26 Jun 2025 04:16:21 +0000 (16:16 +1200)] 
pytests: move dsdb_dn tests out of common

dsdb_Dn hasn't been in samba.common since
85d2ff2f0003b106ca84866b7e7893723f1dd93c
and the tests should follow.

Although dsdb_Dn is currently in samba.samdb, we aren't moving the
tests to samba.tests.samdb, because those tests need a real AD
environment whereas these ones can run more cheaply in the "none"
environment.

Another patch will improve the remaining samba.common tests.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
7 days agoWHATSNEW: Start release notes for Samba 4.24.0pre1.
Jule Anger [Thu, 7 Aug 2025 11:40:00 +0000 (13:40 +0200)] 
WHATSNEW: Start release notes for Samba 4.24.0pre1.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jule Anger <janger@samba.org>
Autobuild-Date(master): Thu Aug  7 14:52:05 UTC 2025 on atb-devel-224

7 days agoVERSION: Bump version up to 4.24.0pre1...
Jule Anger [Thu, 7 Aug 2025 11:34:41 +0000 (13:34 +0200)] 
VERSION: Bump version up to 4.24.0pre1...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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

7 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

8 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

8 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>
8 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>
9 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

9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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

9 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>
9 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>
9 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>
9 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

9 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>
9 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

9 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>
9 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>