]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 weeks agocharset: make strchr_m/strrchr_m/strstr_m const-correct via C11 _Generic
Andreas Schneider [Wed, 22 Apr 2026 17:05:29 +0000 (19:05 +0200)] 
charset: make strchr_m/strrchr_m/strstr_m const-correct via C11 _Generic

Since glibc-2.43 and C23, strchr/strrchr/strstr use _Generic macros to
return const char * when given const char * input. This caused build
failures in strchr_m and strrchr_m whose fast-path returns passed the
const char * result through as char *:

  lib/util/charset/util_str.c:370: error: return discards 'const'
  qualifier from pointer target type [-Werror=discarded-qualifiers]

Rather than wrapping the returns in discard_const_p (which the project
discourages adding more of), fix the API properly: rename the
implementations to strchr_m_const/strrchr_m_const/strstr_m_const
returning const char *, and expose C11 _Generic macros under the
original names. The macros preserve the caller's const qualification:
char * input yields char *, const char * input yields const char *.
This matches C23 strchr semantics and requires no changes at call sites.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 weeks agolibcli:auth: fix BURN_DATA_SIZE on array-decayed pointer parameter
Andreas Schneider [Wed, 20 May 2026 14:22:43 +0000 (16:22 +0200)] 
libcli:auth: fix BURN_DATA_SIZE on array-decayed pointer parameter

_encode_pwd_buffer_from_str() declares `buf` as uint8_t buf[N],
which decays to a pointer. BURN_DATA_SIZE(buf, N) expands to
memset_explicit(&buf, 0, N), taking the address of the pointer
variable (8 bytes) rather than the buffer itself, triggering a
GCC -Wstringop-overflow error.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 weeks agos3:nmbd: fix stringop-overflow warnings
Stefan Metzmacher [Mon, 30 Mar 2026 15:17:48 +0000 (17:17 +0200)] 
s3:nmbd: fix stringop-overflow warnings

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
3 weeks agolib/replace: add _ALIGNED_(n) as __attribute__((aligned(n)))
Andreas Schneider [Wed, 20 May 2026 17:26:27 +0000 (19:26 +0200)] 
lib/replace: add _ALIGNED_(n) as __attribute__((aligned(n)))

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 weeks agolib:compression: Fix _POSIX_C_SOURCE/_XOPEN_SOURCE redefinition issue
Andreas Schneider [Wed, 20 May 2026 16:29:12 +0000 (18:29 +0200)] 
lib:compression: Fix _POSIX_C_SOURCE/_XOPEN_SOURCE redefinition issue

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
3 weeks agobuild: clang 23 enable unused-but-set-global
Gary Lockyer [Tue, 19 May 2026 22:18:43 +0000 (10:18 +1200)] 
build: clang 23 enable unused-but-set-global

All the offending code has been fixed so re-enable the warning as an error.

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): Thu May 21 08:18:46 UTC 2026 on atb-devel-224

3 weeks agos3:torture:torture remove unread global got_alarm
Gary Lockyer [Tue, 19 May 2026 22:16:14 +0000 (10:16 +1200)] 
s3:torture:torture remove unread global got_alarm

Removed as it was declared and updated, but never read.  This triggers the
clang 23 warning unused-but-set-global

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>
3 weeks agolib:talloc:testsuite remove unread global test_abort_stop
Gary Lockyer [Tue, 19 May 2026 22:11:13 +0000 (10:11 +1200)] 
lib:talloc:testsuite remove unread global test_abort_stop

Removed as it was declared and updated, but never read.  This triggers the
clang 23 warning unused-but-set-global

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>
3 weeks agos4:torture:raw:offline remove unread global num_connected
Gary Lockyer [Tue, 19 May 2026 21:58:56 +0000 (09:58 +1200)] 
s4:torture:raw:offline remove unread global num_connected

Removed as it was declared and updated, but never read.  This triggers the
clang 23 warning unused-but-set-global

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>
3 weeks agos4:torture:util_smb remove unread global procnum
Gary Lockyer [Tue, 19 May 2026 21:26:15 +0000 (09:26 +1200)] 
s4:torture:util_smb remove unread global procnum

Removed as as it was declared and updated, but never read.  This triggers the
clang 23 warning unused-but-set-global

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>
3 weeks agos4:torture:util_smb fix trailing white space
Gary Lockyer [Tue, 19 May 2026 21:25:15 +0000 (09:25 +1200)] 
s4:torture:util_smb fix trailing white space

Fix trailing white space issues

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>
3 weeks agotdb:tools:tdbtool remove unread global total_bytes
Gary Lockyer [Tue, 19 May 2026 21:19:09 +0000 (09:19 +1200)] 
tdb:tools:tdbtool remove unread global total_bytes

Removed as as it was declared and updated, but never read.  This triggers the
clang 23 warning unused-but-set-global

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>
3 weeks agobuild: Allow developer builds with clang 23
Gary Lockyer [Tue, 19 May 2026 04:47:05 +0000 (16:47 +1200)] 
build: Allow developer builds with clang 23

Disable the unused-but-set-global warning to allow samba to be compiled with
clang 23

Subsequent commits will fix the offending code.

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>
3 weeks agos3/smb_prometheus_endpoint: single function to export profile stats
Shachar Sharon [Mon, 27 Apr 2026 08:58:10 +0000 (11:58 +0300)] 
s3/smb_prometheus_endpoint: single function to export profile stats

Avoid duplicated defines: use 'export_profile_stats' to export both
global profile counters and per-share counters.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu May 21 06:41:46 UTC 2026 on atb-devel-224

3 weeks agoprofile: use single sections-stats define
Shachar Sharon [Mon, 27 Apr 2026 08:58:31 +0000 (11:58 +0300)] 
profile: use single sections-stats define

Using multiple sections defines (both SMBPROFILE_STATS_ALL_SECTIONS
and SMBPROFILE_STATS_PERSVC_SECTIONS) creates maintenance burden with
no real benefit. Use only single definition with the penalty of emitting
all zeros on unused fields in the case of persvc profile.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 weeks agoprofile: protect from negative refcnt in persvc
Shachar Sharon [Mon, 13 Apr 2026 08:43:42 +0000 (11:43 +0300)] 
profile: protect from negative refcnt in persvc

The function `smbprofile_persvc_unref` may be called by smb2_service.c
due to `on_err_call_profile_unref`. In such case, need to protect from
possible negative refcnt of persvc entry.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 weeks agoprofile: set proper level in REQ_PROFILELEVEL
Shachar Sharon [Mon, 13 Apr 2026 08:22:01 +0000 (11:22 +0300)] 
profile: set proper level in REQ_PROFILELEVEL

Set proper level value, within valid range [0,2], for MSG_PROFILELEVEL.
Fixes a bug in existing code where return 'level' my be in non-valid
values 3 or 7.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 weeks agoprofile: fix edge-case where magic is zero
Shachar Sharon [Sun, 12 Apr 2026 12:05:10 +0000 (15:05 +0300)] 
profile: fix edge-case where magic is zero

For the edge case, where the first 8-bytes of digest are all zero, pull
the next 8-bytes as 64LE.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
3 weeks agosource4/librpc: Add NULL check in dcerpc_secondary_auth_connection()
Anoop C S [Tue, 19 May 2026 10:47:56 +0000 (16:17 +0530)] 
source4/librpc: Add NULL check in dcerpc_secondary_auth_connection()

When dcerpc_secondary_auth_connection_send() fails, it returns NULL.
The NULL pointer is passed to dcerpc_secondary_auth_connection_recv()
which dereferences it without checking, causing a NULL pointer
dereference.

Add NULL check before calling the recv function and return
NT_STATUS_NO_MEMORY.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu May 21 03:24:09 UTC 2026 on atb-devel-224

3 weeks agosource4/dsdb: Fix NULL dereference in attribute_list_from_class()
Anoop C S [Tue, 19 May 2026 10:43:40 +0000 (16:13 +0530)] 
source4/dsdb: Fix NULL dereference in attribute_list_from_class()

When dsdb_class_by_lDAPDisplayName_ldb_val() returns NULL due
to a missing class in the schema, the result is passed to
attribute_list_from_class() without validation. The function
immediately dereferences sclass when calling dsdb_attribute_list(),
causing a NULL pointer dereference.

Add NULL check at the entry of attribute_list_from_class() and return
NULL for missing schema classes.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource4/dsdb: Fix NULL dereference in vlv_results()
Anoop C S [Tue, 19 May 2026 10:38:02 +0000 (16:08 +0530)] 
source4/dsdb: Fix NULL dereference in vlv_results()

When vlv_search_by_dn_guid() returns an error other than
LDB_SUCCESS, the result pointer remains uninitialized. The
subsequent condition uses OR logic that only guards result->count
when ret equals LDAP_NO_SUCH_OBJECT. For any other error code,
result remains NULL and is dereferenced, causing a NULL pointer
dereference.

Fix by reorganizing the if condition to ensure the dereferencing
statement only executes when LDB_SUCCESS is returned.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource4/dsdb: Fix NULL dereference in log_membership_changes()
Anoop C S [Tue, 19 May 2026 10:31:55 +0000 (16:01 +0530)] 
source4/dsdb: Fix NULL dereference in log_membership_changes()

When get_parsed_dns() fails due to OOM, it returns NULL. Without
checking for NULL before the comparison loop, old_val and new_val
are dereferenced causing a NULL pointer dereference.

Add explicit NULL guards after both get_parsed_dns() calls and return
early if either fails when the corresponding element has values.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource3/smbd: Fix NULL dereference in smbXsrv_open_cleanup_fn()
Anoop C S [Wed, 13 May 2026 08:37:49 +0000 (14:07 +0530)] 
source3/smbd: Fix NULL dereference in smbXsrv_open_cleanup_fn()

If smbXsrv_open_global_parse_record() fails, global remains NULL. The
do_delete path then attempts to dereference it, causing a crash. Add a
NULL check before accessing global->client_guid and global->create_guid.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource3/passdb: Fix NULL dereference in _lsa_LookupSids()
Anoop C S [Tue, 19 May 2026 10:07:28 +0000 (15:37 +0530)] 
source3/passdb: Fix NULL dereference in _lsa_LookupSids()

When lookup_sids() returns NT_STATUS_NONE_MAPPED but exits early without
populating the names array, the subsequent dereference of names causes a
NULL pointer dereference.

Return an appropriate error status that allows existing error handling
to catch this case before the NULL dereference occurs.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource3/passdb: Add NULL check in pdb_samba_dsdb_update_sam_account()
Anoop C S [Wed, 13 May 2026 08:20:40 +0000 (13:50 +0530)] 
source3/passdb: Add NULL check in pdb_samba_dsdb_update_sam_account()

pdb_samba_dsdb_get_samu_private() can return NULL on memory allocation or
database query failures. Add an explicit NULL check to prevent dereference
and return an error status early.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource3/rpc_client: Fix NULL dereference in winreg_get_printer()
Anoop C S [Wed, 13 May 2026 07:18:57 +0000 (12:48 +0530)] 
source3/rpc_client: Fix NULL dereference in winreg_get_printer()

When dcerpc_winreg_enumvals() returns 0 values, the loop is skipped
but the error check still tries to dereference 'v' (which was never
initialized).

Add a guard to only check error status if num_values > 0, and reset
the result to WERR_OK on success to prevent spurious error handling.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agovfs_fruit: Fix uninitialized variable in fruit_fstatat_meta()
Anoop C S [Wed, 13 May 2026 08:44:38 +0000 (14:14 +0530)] 
vfs_fruit: Fix uninitialized variable in fruit_fstatat_meta()

The variable smb_relname is used uninitialized in fruit_fstatat_meta().
This appears to be a copy-paste error where _smb_relname (the function
parameter) should have been used instead.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
3 weeks agosource3/adouble: Assert fsp is not NULL in ad_fget()
Anoop C S [Wed, 13 May 2026 06:25:06 +0000 (11:55 +0530)] 
source3/adouble: Assert fsp is not NULL in ad_fget()

The DBG_DEBUG() in ad_open() dereferences smb_fname, which can be NULL
when ad_fget() calls ad_get_internal(). Add an SMB_ASSERT() guard in
ad_fget() to catch this early.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 weeks agosamba-tool: fix documentation for timestamp format specifiers
Björn Jacke [Mon, 11 May 2026 08:54:07 +0000 (10:54 +0200)] 
samba-tool: fix documentation for timestamp format specifiers

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Tue May 12 11:19:12 UTC 2026 on atb-devel-224

4 weeks agos3:winbind: Do not fallback to NCACN_NP Netlogon/LSA connections for AD domains
Andreas Schneider [Wed, 4 Feb 2026 14:10:02 +0000 (15:10 +0100)] 
s3:winbind: Do not fallback to NCACN_NP Netlogon/LSA connections for AD domains

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon May 11 21:24:02 UTC 2026 on atb-devel-224

4 weeks agopam_winbind: only chown the home directory if it was created
Stefan Metzmacher [Fri, 8 May 2026 13:01:08 +0000 (15:01 +0200)] 
pam_winbind: only chown the home directory if it was created

Otherwise we may change the permission for '/'
if some systemuser (e.g. nobody) has no homedir and root
runs 'su - nobody'.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Sun May 10 23:22:27 UTC 2026 on atb-devel-224

4 weeks agos3:winbindd: ignore unsupported anonymous smb sessions for AD trusts
Stefan Metzmacher [Tue, 5 May 2026 12:59:54 +0000 (14:59 +0200)] 
s3:winbindd: ignore unsupported anonymous smb sessions for AD trusts

This is handles the cases where a DC has
'Require NTLMv2 session security' activated which
disables anonymous NTLMSSP and let the server return
NT_STATUS_NOT_SUPPORTED.

Similar problems happen with a Samba DC that
uses 'restrict anonymous = 2' and the
tcon to ipc$ fails with NT_STATUS_ACCESS_DENIED.

For active directory related trusts we only use
ncacn_ip_tcp (or ncalrpc), so there's no need for
a valid smb connection.

Historically it very hard to restructure the code
in order to only connect smb for ncacn_np, so
this is more a hack to let us work in real world
scenarios.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
5 weeks agos3:winbind: fix response array leak on error paths
Shweta Sodani [Tue, 21 Apr 2026 12:03:29 +0000 (17:33 +0530)] 
s3:winbind: fix response array leak on error paths

Free map_ids_out.ids unconditionally when it differs from
map_ids_in.ids, not only on success.

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Sat May  9 11:51:32 UTC 2026 on atb-devel-224

5 weeks agos3:winbind: add bounds check for dom_sid_idx
Shweta Sodani [Tue, 21 Apr 2026 12:03:18 +0000 (17:33 +0530)] 
s3:winbind: add bounds check for dom_sid_idx

Add SMB_ASSERT to verify dom_sid_idx stays within the
dom_sids/dom_xids array bounds in wb_xids2sids_dom_done().

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
5 weeks agoctdb-server: Cleanup child resources via local helper
Shachar Sharon [Tue, 5 May 2026 10:17:18 +0000 (13:17 +0300)] 
ctdb-server: Cleanup child resources via local helper

Define 'revokechild_finish' as resource cleanup helper. Call it either
via destructor (normal case) or upon allocation failure.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed May  6 05:28:48 UTC 2026 on atb-devel-224

5 weeks agoctdb-server: Fix use-after-free bug
Shachar Sharon [Tue, 5 May 2026 10:04:22 +0000 (13:04 +0300)] 
ctdb-server: Fix use-after-free bug

When 'rev_hdl->fde' is NULL due to failure in tevent_add_fd bail-out
with free-and-error in order to avoid pointer dereferencing 'rev_hdl'
after it is freed.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
6 weeks agolibcli/dns: fix use-after-free oom case
Shachar Sharon [Thu, 30 Apr 2026 11:11:49 +0000 (14:11 +0300)] 
libcli/dns: fix use-after-free oom case

A failure to tevent_wakeup_recv(subreq) should trigger oom call on 'req'
(instead on 'subreq', which has already been free).

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Sat May  2 14:51:58 UTC 2026 on atb-devel-224

6 weeks agolibcli/dns: Add TCP parallel fallback after 1 second UDP timeout
Volker Lendecke [Mon, 20 Apr 2026 13:54:59 +0000 (15:54 +0200)] 
libcli/dns: Add TCP parallel fallback after 1 second UDP timeout

Comes with refactoring: Add EDNS0 only to the UDP request, try TCP on
any UDP failure. This patch should probably be split up into several
micro-commits, but the code is very simply structured, so I'd propose
to put this in as is. For review, just look at the final code :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Apr 29 17:40:38 UTC 2026 on atb-devel-224

6 weeks agolibcli/dns: Make SMB_ASSERT available
Volker Lendecke [Wed, 22 Apr 2026 14:41:20 +0000 (16:41 +0200)] 
libcli/dns: Make SMB_ASSERT available

SMB_ASSERT requires "lib/util/debug.h" first and then
"lib/util/samba_util.h":

1. #include "lib/util/debug.h"

   * _SAMBA_DEBUG_H is now defined

2. #include "lib/util/samba_util.h"

   * samba_util.h includes fault.h
   * fault.h checks: #ifdef _SAMBA_DEBUG_H (only if yes, SMB_ASSERT
     gets defined)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
6 weeks agolibcli/dns: dns_udp_request_get_reply -> dns_udp_request_sent
Volker Lendecke [Mon, 20 Apr 2026 13:56:34 +0000 (15:56 +0200)] 
libcli/dns: dns_udp_request_get_reply -> dns_udp_request_sent

More in line with typical async code right now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
6 weeks agolibcli/dns: Avoid a local variable referenced only once
Volker Lendecke [Mon, 20 Apr 2026 13:40:02 +0000 (15:40 +0200)] 
libcli/dns: Avoid a local variable referenced only once

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
6 weeks agolibcli/dns: Simplify dns over tcp requests, save 39 lines :-)
Volker Lendecke [Tue, 31 Mar 2026 16:28:41 +0000 (18:28 +0200)] 
libcli/dns: Simplify dns over tcp requests, save 39 lines :-)

tstream_readv_pdu_send() is overkill here, tstream_read_packet_send()
is sufficient. The only downside is that dns_tcp_request_recv() does
not return a talloc context on its own in reply anymore, but as the
reply is immediately ndr-parsed, so we keep that around only a tiny
bit longer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
6 weeks agosmbd: do S_ISDIR check even earlier
Ralph Boehme [Wed, 1 Apr 2026 09:58:03 +0000 (11:58 +0200)] 
smbd: do S_ISDIR check even earlier

Doing this in open_file() is too late, as when the client requests an open with
SEC_FLAG_MAXIMUM_ALLOWED on a directory that has FILE_ATTRIBUTE_READ_ONLY set,
this will currently trigger an NT_STATUS_ACCESS_DENIED by the following code in
open_file_ntcreate() if the ACL grants write access to the user:

        if (((flags & O_ACCMODE) != O_RDONLY) && file_existed &&
            (!CAN_WRITE(conn) ||
             (existing_dos_attributes & FILE_ATTRIBUTE_READONLY))) {
                DEBUG(5,("open_file_ntcreate: write access requested for "
                         "file %s on read only %s\n",
                         smb_fname_str_dbg(smb_fname),
                         !CAN_WRITE(conn) ? "share" : "file" ));
                return NT_STATUS_ACCESS_DENIED;
        }

Fixes this bug, but should otherwise cause no change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr 29 12:00:18 UTC 2026 on atb-devel-224

6 weeks agosmbd: apply read-only attribute access restrictions only to files
Ralph Boehme [Wed, 1 Apr 2026 12:10:38 +0000 (14:10 +0200)] 
smbd: apply read-only attribute access restrictions only to files

Also mask off the exact access rights given in MS_FSA 2.1.5.1.2.1 "Algorithm to
Check Access to an Existing File".

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 weeks agosmbd: ignore FILE_ATTRIBUTE_READONLY for the "MxAC" create context
Ralph Boehme [Wed, 1 Apr 2026 12:04:40 +0000 (14:04 +0200)] 
smbd: ignore FILE_ATTRIBUTE_READONLY for the "MxAC" create context

As much as I dislike adding a boolean parameter to control this behaviour, I
don't see a different clean way to do it.

Note that I'm not touching the case where the share is realy-only, I just don't
want to open that additional can of worms now and instead focus on fixing the
FILE_ATTRIBUTE_READONLY case.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 weeks agosmbd: split read-only checks in smbd_calculate_maximum_allowed_access_fsp()
Ralph Boehme [Thu, 9 Apr 2026 08:13:49 +0000 (10:13 +0200)] 
smbd: split read-only checks in smbd_calculate_maximum_allowed_access_fsp()

Prepares for adjusting the permission when the FILE_ATTRIBUTE_READONLY is set in
the next commmit.

No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 weeks agosmbtorture: add test smb2.maximum_allowed.read_only_dir
Ralph Boehme [Wed, 1 Apr 2026 10:28:55 +0000 (12:28 +0200)] 
smbtorture: add test smb2.maximum_allowed.read_only_dir

Verifies that FILE_ATTRIBUTE_READONLY is effectively ignored on directories.

Passes against Windows, fails against Samba: Samba enforces read-only access in
fsp->access_mask and "MxAC" create context response for directories with
FILE_ATTRIBUTE_READONLY. This is wrong, Windows doesn't do this.

Note that MS-FSA doesn't quite has all these details right, the correct
behaviour was taken from a modern Windows server.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 weeks agosmbtorture: add additional checks to smb2.maximum_allowed.read_only_file
Ralph Boehme [Wed, 1 Apr 2026 10:26:28 +0000 (12:26 +0200)] 
smbtorture: add additional checks to smb2.maximum_allowed.read_only_file

Prooves that:

- the "MxAC" context response actually ignores FILE_ATTRIBUTE_READONLY,

- actuall effective access rights honor FILE_ATTRIBUTE_READONLY (using
  RAW_FILEINFO_ACCESS_INFORMATION getinfo level),

- attempting to write to a file with FILE_ATTRIBUTE_READONLY fails.

Test passed against Windows, fails against both s3 and s4 servers. Skipping the
ad_dc_ntvfs test in the future, I'm not going to fix that.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 weeks agosmbtorture: rename test smb2.maximum_allowed.read_only to smb2.maximum_allowed.read_o...
Ralph Boehme [Wed, 1 Apr 2026 10:19:35 +0000 (12:19 +0200)] 
smbtorture: rename test smb2.maximum_allowed.read_only to smb2.maximum_allowed.read_only_file

Soon going to add another test for directories called smb2.maximum_allowed.read_only_dir.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 weeks agodocs-xml: Improve documentation for 'winbind reconnect delay'
Andreas Schneider [Wed, 10 Dec 2025 19:29:59 +0000 (20:29 +0100)] 
docs-xml: Improve documentation for 'winbind reconnect delay'

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Apr 29 09:32:21 UTC 2026 on atb-devel-224

6 weeks agodocs-xml: Improve documentation for 'winbind request timeout'
Andreas Schneider [Wed, 10 Dec 2025 19:31:53 +0000 (20:31 +0100)] 
docs-xml: Improve documentation for 'winbind request timeout'

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 weeks agoctdb-server: Avoid removing connections for released IP
Martin Schwenke [Wed, 4 Feb 2026 03:53:54 +0000 (14:53 +1100)] 
ctdb-server: Avoid removing connections for released IP

Commit c6602b686b4e50d93272667ef86d3904181fb1ab causes TCP connections
to be cleared whenever an associated client goes away.  This shouldn't
happen when the associated public IP is being released, since the
takeover node will need the connection details to send tickle ACKs.

Sorry, I missed this when reviewing that commit.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Apr 29 02:58:12 UTC 2026 on atb-devel-224

6 weeks agos3:winbindd: let wb_irpc_SamLogon reject the local domain as RWDC
Stefan Metzmacher [Mon, 27 Apr 2026 16:13:36 +0000 (18:13 +0200)] 
s3:winbindd: let wb_irpc_SamLogon reject the local domain as RWDC

If the clients use a subdomain of our domain the
'sam' auth backend passed the request along to
the 'winbind' auth backend. If winbindd tries
to use the local domain we hit the case that
an unknown domain was used. So we need to
bounce the request back to 'sam_ignoredomain'.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 28 11:49:16 UTC 2026 on atb-devel-224

6 weeks agos3:winbindd: replace smbXcli_conn_remote_{name,sockaddr}() with domain->{dcname,dcaddr}
Stefan Metzmacher [Mon, 27 Apr 2026 16:31:55 +0000 (18:31 +0200)] 
s3:winbindd: replace smbXcli_conn_remote_{name,sockaddr}() with domain->{dcname,dcaddr}

domain->conn.cli might be NULL, so we should not deference it.

init_dc_connection_rpc() already checks that domain->dcname is not
NULL...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 weeks agos3:winbindd: let init_dc_connection_rpc() fail if domain->dcname is still NULL
Stefan Metzmacher [Mon, 27 Apr 2026 16:14:18 +0000 (18:14 +0200)] 
s3:winbindd: let init_dc_connection_rpc() fail if domain->dcname is still NULL

This can happen on a DC itself trying to talk to itself,
which is currently not expected.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
7 weeks agos3:loadparm: return NULL upon memalloc failure in lp_idmap_backend
Shachar Sharon [Thu, 23 Apr 2026 09:49:17 +0000 (12:49 +0300)] 
s3:loadparm: return NULL upon memalloc failure in lp_idmap_backend

Return NULL instead of valid-but-misleading cast from 'false' to
pointer.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Apr 23 20:53:10 UTC 2026 on atb-devel-224

7 weeks agos4:torture: Retry DsExecuteKCC on NT_STATUS_DS_BUSY
Andreas Schneider [Wed, 25 Mar 2026 14:52:02 +0000 (15:52 +0100)] 
s4:torture: Retry DsExecuteKCC on NT_STATUS_DS_BUSY

The KCC service runs a periodic samba_kcc child process (every 300s,
first at 15s after startup) with a 40 second timeout. If a test calls
DsExecuteKCC while the periodic child is running, kccsrv returns
NT_STATUS_DS_BUSY which propagates as EPT_NT_CANT_PERFORM_OP to the
client, causing flaky test failures.

UNEXPECTED(error): samba4.drs.samba_tool_drs_showrepl.python(schema_pair_dc).samba_tool_drs_showrepl.SambaToolDrsShowReplTests.test_samba_tool_showrepl(schema_pair_dc:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "/builds/samba-testbase/samba-def-build/source4/torture/drs/python/samba_tool_drs_showrepl.py", line 57, in test_samba_tool_showrepl
    kcc_out = self.check_output("samba-tool drs kcc %s %s" % (self.dc1,
  File "/builds/samba-testbase/samba-def-build/bin/python/samba/tests/__init__.py", line 593, in check_output
    raise BlackboxProcessError(retcode, line, stdoutdata, stderrdata)
samba.tests.BlackboxProcessError: Command 'python3 bin/samba-tool drs kcc liveupgrade1dc -USCHEMADOMAIN/Administrator%locDCpass1'; shell True; exit status 255;
stdout: ''; stderr: 'ERROR(runtime): DsExecuteKCC failed - (3221356597, 'The operation cannot be performed.')

3221356597 => 0xc0020035 (EPT_NT_CANT_PERFORM_OP)

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Apr 23 07:55:04 UTC 2026 on atb-devel-224

7 weeks agos3:tests: Improve debugging for test_wbinfo_lookuprids_cache.sh
Andreas Schneider [Fri, 10 Apr 2026 13:45:08 +0000 (15:45 +0200)] 
s3:tests: Improve debugging for test_wbinfo_lookuprids_cache.sh

Note that if this test fails, it is like something else creating keys.
The last time it was a crashing smbd which left a key in the database
and this test failed as a result.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Apr 22 16:35:58 UTC 2026 on atb-devel-224

7 weeks agoWHATSNEW: deprecated "allow dcerpc auth level connect"
Stefan Metzmacher [Wed, 22 Apr 2026 10:56:53 +0000 (12:56 +0200)] 
WHATSNEW: deprecated "allow dcerpc auth level connect"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr 22 14:19:03 UTC 2026 on atb-devel-224

7 weeks agodocs-xml/smbdotconf: deprecated "allow dcerpc auth level connect"
Stefan Metzmacher [Wed, 22 Apr 2026 10:54:29 +0000 (12:54 +0200)] 
docs-xml/smbdotconf: deprecated "allow dcerpc auth level connect"

This was only added to prevent problems with the fixes for
CVE-2016-2118.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 weeks agothird_party/ngtcp2: import v1.22.1 for CVE-2026-40170
Stefan Metzmacher [Fri, 17 Apr 2026 08:45:58 +0000 (10:45 +0200)] 
third_party/ngtcp2: import v1.22.1 for CVE-2026-40170

For CVE-2026-40170 see:
https://github.com/ngtcp2/ngtcp2/security/advisories/GHSA-f523-465f-8c8f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 weeks agovfs_ceph_new: remove double-cleanup in closedir
Shweta Sodani [Mon, 6 Apr 2026 05:53:32 +0000 (11:23 +0530)] 
vfs_ceph_new: remove double-cleanup in closedir

vfs_ceph_release_fh() was called explicitly then again via the FSP
extension destructor triggered by vfs_ceph_remove_fh(). Drop the
explicit call and let the destructor handle cleanup.

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Apr 21 22:18:42 UTC 2026 on atb-devel-224

7 weeks agovfs_ceph_new: fix return type mismatch in disk_free
Shweta Sodani [Mon, 6 Apr 2026 05:51:56 +0000 (11:21 +0530)] 
vfs_ceph_new: fix return type mismatch in disk_free

-ENOMEM cast to uint64_t is not the error sentinel UINT64_MAX and
leaves errno unset. Set errno and return UINT64_MAX instead.
Also replace UINT64_MAX instead of (uint64_t)-1) in all error path.

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
7 weeks agovfs_ceph_new: fix END_PROFILE/END_PROFILE_X mismatch in ftruncate
Shweta Sodani [Mon, 6 Apr 2026 05:50:55 +0000 (11:20 +0530)] 
vfs_ceph_new: fix END_PROFILE/END_PROFILE_X mismatch in ftruncate

END_PROFILE omits the per-service counter; replace with END_PROFILE_X
to match the START_PROFILE_X on the strict_allocate path.

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
7 weeks agos3/brlock: map nt-error from correct errno-value
Shachar Sharon [Sun, 19 Apr 2026 13:07:11 +0000 (16:07 +0300)] 
s3/brlock: map nt-error from correct errno-value

The functions 'brl_lock_windows_default' and 'brl_lock_posix' uses
explicit 'errno_ret' value to avoid possible errno overwrite. Use in
failure case.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Shwetha Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Apr 21 02:05:57 UTC 2026 on atb-devel-224

7 weeks agosmbdotconf: Add "automount fs types" to smb.conf
Pavel Filipenský [Tue, 7 Apr 2026 14:28:05 +0000 (16:28 +0200)] 
smbdotconf: Add "automount fs types" to smb.conf

This adds a new global parameter "automount fs types" that allows
administrators to configure additional filesystem types that should
trigger automounting, beyond the always-supported autofs filesystem.

To enable 'samba unaware FS' automounting, add:

    automount fs types = 0x12345678

This allows e.g. ZFS snapshots in <dataset root>/.zfs/snapshot to be
mounted. To find out the magic number that is not listed
in /usr/include/linux/magic.h, run:

    stat -f -c '0x%t' /path/to/mountpoint

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Apr 20 19:57:42 UTC 2026 on atb-devel-224

8 weeks agovfs_gpfs: convert smb2gpfs_acl() to use talloc
Shwetha Acharya [Thu, 16 Apr 2026 13:45:19 +0000 (19:15 +0530)] 
vfs_gpfs: convert smb2gpfs_acl() to use talloc

This avoids mixing malloc and talloc allocation patterns and
aligns the code with Samba's memory management conventions.

Signed-off-by: Shwetha Acharya <Shwetha.K.Acharya@ibm.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Sat Apr 18 20:58:22 UTC 2026 on atb-devel-224

8 weeks agoctdb-scripts: Support interface altnames
Martin Schwenke [Thu, 9 Apr 2026 07:52:20 +0000 (17:52 +1000)] 
ctdb-scripts: Support interface altnames

This avoids generating a warning like:

  WARNING: Public IP <ip> hosted on interface <iface> but VNN says <altname>

every time a public IP is removed from an interface that is configured
via an altname.

The new check will nearly always be successful because the IP will be
on the expected interface during releaseip/updateip.

The original check is now used as a backup when the IP is not on the
expected interface.  To allow the mask bits check to cover both cases,
the original check and the associated interface check needs to be
inside the else clause.

Update the unit test to reflect the change.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Apr 17 00:11:50 UTC 2026 on atb-devel-224

8 weeks agoctdb-tests: Add addip/releaseip altname unit test
Martin Schwenke [Mon, 13 Apr 2026 04:48:07 +0000 (14:48 +1000)] 
ctdb-tests: Add addip/releaseip altname unit test

This shows that a warning is generated whenever an IP address is
removed using an altname.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-tests: Implement altname property for ip link/addr
Martin Schwenke [Mon, 13 Apr 2026 04:18:28 +0000 (14:18 +1000)] 
ctdb-tests: Implement altname property for ip link/addr

Only implemented for these commands.  I don't even want to think about
doing this for ip route right now.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Rename/reimplement get_iface_ip_maskbits()
Martin Schwenke [Thu, 9 Apr 2026 05:29:10 +0000 (15:29 +1000)] 
ctdb-scripts: Rename/reimplement get_iface_ip_maskbits()

Reimplement to set prefix instead of maskbits.  Rename to
get_ip_prefix_iface().

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Add function ip_prefix_iface()
Martin Schwenke [Wed, 8 Apr 2026 23:40:55 +0000 (09:40 +1000)] 
ctdb-scripts: Add function ip_prefix_iface()

Reimplement ip_maskbits_iface() using the ip -brief option.  Do less
parsing, no longer extract maskbits but return whole prefix.

Retain ip_maskbits_iface() for backward compatibility in case custom
event scripts are using it.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-tests: Implement -brief option for ip addr show stub
Martin Schwenke [Wed, 8 Apr 2026 03:02:52 +0000 (13:02 +1000)] 
ctdb-tests: Implement -brief option for ip addr show stub

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-tests: Fix a typo in "ip link show" stub output
Martin Schwenke [Wed, 8 Apr 2026 02:10:43 +0000 (12:10 +1000)] 
ctdb-tests: Fix a typo in "ip link show" stub output

Status is different to state and should not be repeated.  For example:

eth0             UP             aa:bb:cc:dd:ee:ff <BROADCAST,MULTICAST,UP,LOWER_UP>

Clearly nothing looks at this field but it should be correct.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Drop full address prefix lengths
Martin Schwenke [Thu, 2 Apr 2026 07:23:52 +0000 (18:23 +1100)] 
ctdb-scripts: Drop full address prefix lengths

ip addr assumes these defaults anyway.  They are just noise.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Add an extra variable to help reviewers
Martin Schwenke [Fri, 10 Apr 2026 01:22:19 +0000 (11:22 +1000)] 
ctdb-scripts: Add an extra variable to help reviewers

Using $_bcast to determine if the address is an IPv6 one is lazy.  It
causes anyone reading the code (including the original author) to have
to go back and confirm that the condition makes sense.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Add function ip_addr_add()
Martin Schwenke [Wed, 8 Apr 2026 01:28:41 +0000 (11:28 +1000)] 
ctdb-scripts: Add function ip_addr_add()

For consistency with new ip_addr_del().

Update all callers of add_ip_to_iface() to use this function
instead.

Retain add_ip_to_iface() for backward compatibility in case custom
event scripts are using it.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Add function ip_addr_del()
Martin Schwenke [Thu, 2 Apr 2026 01:45:05 +0000 (12:45 +1100)] 
ctdb-scripts: Add function ip_addr_del()

Using a prefix is more natural because it matches "ip addr ..." usage.
It should also allow for less parsing.

Update all callers of delete_ip_from_iface() to use this function
instead.

Retain delete_ip_from_iface() for backward compatibility in case
custom event scripts are using it.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Only warn when removing an unassigned public IP
Martin Schwenke [Thu, 9 Apr 2026 02:15:33 +0000 (12:15 +1000)] 
ctdb-scripts: Only warn when removing an unassigned public IP

get_iface_ip_maskbits() now sets iface="" when the IP is unassigned,
allowing dependent code to be conditional.

Currently, ctdb_takeover.c:ctdb_control_release_ip() ensures no
releaseip event is triggered if the public address is not on the node.
So, no change of behaviour for releaseip.

The previous attempt at making updateip behave more like takeip when
the IP isn't currently assigned caused commands with missing mask bits
to be run.  Avoid this.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Simplify by taking advantage of early return/exit
Martin Schwenke [Thu, 9 Apr 2026 12:02:24 +0000 (22:02 +1000)] 
ctdb-scripts: Simplify by taking advantage of early return/exit

Negate the condition in the if-statement so the current else part goes
first.  It always returns or exits, so the remainder (current if part)
can just follow.

This makes a subsequent change easier to understand.

Probably best reviewed with "git show -w" or similar.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Fix the NAT gateway IP drop in crash cleanup
Martin Schwenke [Thu, 9 Apr 2026 08:10:51 +0000 (18:10 +1000)] 
ctdb-scripts: Fix the NAT gateway IP drop in crash cleanup

This has been bizarrely wrong since commit
095fac9491bfe6a29127d9c3f76c15bc947cf591.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: No longer attempt to delete IP from new interface
Martin Schwenke [Thu, 9 Apr 2026 02:12:29 +0000 (12:12 +1000)] 
ctdb-scripts: No longer attempt to delete IP from new interface

Since commit 6471541d6d2bc9f2af0ff92b280abbd1d933cf88 this is
completely unnecessary because interface $oiface is determined by
looking at the system.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Add address with specified mask bits in updateip
Martin Schwenke [Thu, 9 Apr 2026 02:08:40 +0000 (12:08 +1000)] 
ctdb-scripts: Add address with specified mask bits in updateip

That is, add using $_maskbits, not $maskbits.

In the rare case where the mask bits were inconsistent on the old
interface, $maskbits will be needed for removal from the old
interface.

However, the specified mask bits ($_maskbits) must always be used when
adding to the new interface.  Circumstances where this matters are
likely to be very rare.

It matters more if the address is unexpectedly not assigned at all.
In this case $maskbits will not be set, so the address can't be added
to the new interface using that variable.

This got confused in commit 6471541d6d2bc9f2af0ff92b280abbd1d933cf88.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Change style to use if-statements
Martin Schwenke [Fri, 10 Apr 2026 00:51:53 +0000 (10:51 +1000)] 
ctdb-scripts: Change style to use if-statements

Well known, explicit structured programming constructs are arguably
easier to understand than implicit shell magic.

Only change instances that will be updated by subsequent commits.
Doing this separately, instead of in each subsequent commit, will make
those commits easier to understand.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Reformat with "shfmt -w -i 0 -fn"
Martin Schwenke [Wed, 8 Apr 2026 01:31:44 +0000 (11:31 +1000)] 
ctdb-scripts: Reformat with "shfmt -w -i 0 -fn"

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agoctdb-scripts: Avoid a shellcheck complaint
Martin Schwenke [Thu, 2 Apr 2026 01:41:14 +0000 (12:41 +1100)] 
ctdb-scripts: Avoid a shellcheck complaint

In ctdb/config/events/legacy/11.natgw.script line 174:
read _old_natgwleader <"$natgw_leader_old"
                ^--^ SC2162 (info): read without -r will mangle backslashes.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
8 weeks agosmbd: handle synthetic_smb_fname failure properly in delete_all_streams
Shachar Sharon [Thu, 16 Apr 2026 09:04:25 +0000 (12:04 +0300)] 
smbd: handle synthetic_smb_fname failure properly in delete_all_streams

When 'synthetic_smb_fname' fails due to memory error, it returns NULL.
Fix this error-case logic in 'delete_all_streams'.

Signed-off-by: Shachar Sharon <ssharon@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): Thu Apr 16 13:48:23 UTC 2026 on atb-devel-224

8 weeks agondr:dns_utils.h: add header guards
Douglas Bagnall [Wed, 1 Apr 2026 20:35:01 +0000 (09:35 +1300)] 
ndr:dns_utils.h: add header guards

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Apr 16 01:57:42 UTC 2026 on atb-devel-224

8 weeks agondr/util push_dns_string: avoid unnecessary tallocs
Douglas Bagnall [Sat, 25 Apr 2020 02:56:05 +0000 (14:56 +1200)] 
ndr/util push_dns_string: avoid unnecessary tallocs

We know the components are all less than 64 bytes long.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agondr:dns: introduce and use MAX_COMP_LEN
Douglas Bagnall [Wed, 19 Feb 2025 02:44:34 +0000 (15:44 +1300)] 
ndr:dns: introduce and use MAX_COMP_LEN

it means 63 or 0x3f, and is the maximum length of a DNS/NBT component.

We also simplify an error message that was fond of long hex
representations of small numbers.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agondr: pull_dns_string: don't allow dots or '\0' in labels
Douglas Bagnall [Tue, 19 May 2020 22:05:16 +0000 (10:05 +1200)] 
ndr: pull_dns_string: don't allow dots or '\0' in labels

We use a copy function that returns false if the copied string
contains the bad characters, and true otherwise.

As a special case, we allow a '.' as the last character, because an
NBT name with a trailing dot is sometimes used as a username, and we
need to match these exactly, even though the dotless form is
semantically the same (per RFC).

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agolibrpc/tests: Initialize name _test_ndr_pull_dns_string_list
Andreas Schneider [Thu, 9 Apr 2026 05:27:11 +0000 (07:27 +0200)] 
librpc/tests: Initialize name _test_ndr_pull_dns_string_list

When ndr_pull_struct_blob fails (which it will for labels containing
dots, now rejected by the new dns_component_copy check), name remains
uninitialized and the subsequent push call dereference it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
8 weeks agondr: pull_dns_string: check length, use buffers/memcpy
Douglas Bagnall [Sat, 6 Jun 2020 11:22:16 +0000 (23:22 +1200)] 
ndr: pull_dns_string: check length, use buffers/memcpy

RFC 1035 says the maximum length for a DNS name is 255 characters, and
one of the factors that allowed CVE-2020-10745 is that Samba did not
enforce that directly, enabling names around 8k long.

We fix that by keeping track of the name length. It is easier and more
efficient to use a 64 byte buffer for the components, and this will
help us to introduce further hardening in the next commit.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agondr: pull_dns_string: drop nbt/dns mem_ctx difference
Douglas Bagnall [Wed, 20 May 2020 07:18:14 +0000 (19:18 +1200)] 
ndr: pull_dns_string: drop nbt/dns mem_ctx difference

Until now NBT and DNS have used talloc contexts of different lifetimes
to allocate component strings. The actual talloc context doesn't
really matter -- these strings are immediately copied and can be freed
straight after. So that is what we do.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agondr/nbt: use ndr_dns_utils/ndr_pull_dns_string_list
Douglas Bagnall [Tue, 19 May 2020 01:55:53 +0000 (13:55 +1200)] 
ndr/nbt: use ndr_dns_utils/ndr_pull_dns_string_list

To retain exactly the same behaviour with regard to memory contexts
and error messages, we add an is_nbt flag.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agondr/dns: shift pull_dns_string to ndr_dns_util.c
Douglas Bagnall [Wed, 29 Apr 2020 04:16:26 +0000 (16:16 +1200)] 
ndr/dns: shift pull_dns_string to ndr_dns_util.c

This will allow NBT to use the same function (after modifications in
the next commit).

This is post CVE-2020-10745 hardening and optimisation.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agopytests: dns_packet tests check rcodes match Windows
Douglas Bagnall [Wed, 3 Jun 2020 02:42:41 +0000 (14:42 +1200)] 
pytests: dns_packet tests check rcodes match Windows

the dns_packet tests originally checked only for a particular DoS
situation (CVE-2020-10745) but now we widen them to ensure Samba's
replies to invalid packets resembles those of Windows (in particular,
Windows 2012r2). We want Samba to reply only when Windows replies, and
with the same rcode.

At present we fail a lot of these tests.

The original CVE-2020-10745 test is retained and widened indirectly --
any test that leaves the server unable to respond within 0.5 seconds
will count as a failure.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 weeks agos3/modules: fix snapper_gmt_fstatat
Noel Power [Fri, 10 Apr 2026 15:50:55 +0000 (16:50 +0100)] 
s3/modules: fix snapper_gmt_fstatat

snapper_gmt_fstatat is failing when called on items in a
'previous version' snapshot because the wrong timestamp value is
passed (the raw timewarp value is used) and snapper_gmt_convert cannot
find the valid snapshot instance to use.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Wed Apr 15 15:29:38 UTC 2026 on atb-devel-224

8 weeks agos3/modules: Fix vfs snapper not finding files in subdirs
Noel Power [Fri, 10 Apr 2026 10:08:08 +0000 (11:08 +0100)] 
s3/modules: Fix vfs snapper not finding files in subdirs

when trying to browse on windows a snapper share (exposed via windows previous versions) files in subdirs are not visible. In other words only files that are in the root dir of the versioned share can be seen

/ashare/file1
/ashare/file2
/ashare/subdir
/ashare/subdir/subfile1

For example with the file hierarchy above only file1, file2 and subdir are visible. Navigating into subdir shows an empty dir

snapper_gmt_openat is failing because when calling snapper_gmt_convert
it doesn't take into account the path to the subdirectory.
snapper_gmt_convert is just passed the leaf name where it constructs the
snapper path based on the base dir of the share.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
8 weeks agos3:loadparm: fix NULL pointer dereference in volume_label()
Jeremy Allison [Fri, 10 Apr 2026 21:24:34 +0000 (14:24 -0700)] 
s3:loadparm: fix NULL pointer dereference in volume_label()

volume_label() calls lp_servicename() as a fallback when lp_volume()
returns an empty string. lp_servicename() is a FN_LOCAL_SUBSTITUTED_STRING
that falls back to sDefault.szService when the service is invalid. Since
sDefault.szService is initialized to NULL and is never set by
init_globals(), the substitution returns NULL, and the subsequent
strlen() call crashes with a segmentation fault.

Add a NULL guard so volume_label() returns an empty string instead
of crashing.

Remove knownfail.

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 15 00:07:12 UTC 2026 on atb-devel-224