]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
10 months agoldb:tests: make api_base module
Douglas Bagnall [Sat, 17 Aug 2024 02:35:48 +0000 (14:35 +1200)] 
ldb:tests: make api_base module

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoldb:tests:api.py uses .disconnect before rmdir
Douglas Bagnall [Sat, 17 Aug 2024 01:27:52 +0000 (13:27 +1200)] 
ldb:tests:api.py uses .disconnect before rmdir

super.tearDown() was removing the tmpdir, but because self.ldb had
the file open, the directory was not cleared.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoldb:pytest:api: remove unnecessary super() parameters
Douglas Bagnall [Fri, 16 Aug 2024 02:21:20 +0000 (14:21 +1200)] 
ldb:pytest:api: remove unnecessary super() parameters

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoldb:pytest:api: remove pass-though tearDowns
Douglas Bagnall [Fri, 16 Aug 2024 02:06:53 +0000 (14:06 +1200)] 
ldb:pytest:api: remove pass-though tearDowns

The result is exactly the same, unless we previously had the wrong
class name in the pass-through, in which case the result is *probably*
the same, only more correct.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoldb:py bindings: ldb.Ldb().__str__ prints connection URL
Douglas Bagnall [Mon, 19 Aug 2024 00:19:22 +0000 (12:19 +1200)] 
ldb:py bindings: ldb.Ldb().__str__ prints connection URL

before:  "<ldb connection>"
after:   "<ldb connection tdb:///path/to/samdb.ldb>"

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 months agoctdb: Use str_list_add_printf() in lock_helper_args()
Volker Lendecke [Thu, 19 Sep 2024 15:32:42 +0000 (17:32 +0200)] 
ctdb: Use str_list_add_printf() in lock_helper_args()

Saves lines, str_list_add_printf takes care of NULL checks

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): Sun Sep 22 10:44:59 UTC 2024 on atb-devel-224

10 months agoctdb: Change the ctdb_vfork_exec prototype to const char*const*
Volker Lendecke [Fri, 20 Sep 2024 00:54:57 +0000 (02:54 +0200)] 
ctdb: Change the ctdb_vfork_exec prototype to const char*const*

I could not find out how to cast a char ** to const char ** without
warning. This transfers fine to the execv call as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
10 months agosmbd: We can expect the file to exist in is_visible_fsp()
Volker Lendecke [Thu, 19 Sep 2024 14:09:43 +0000 (16:09 +0200)] 
smbd: We can expect the file to exist in is_visible_fsp()

Another leftover from symlinks in posix context to not open an fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agoauth: Fix CID 1615191 Uninitialized scalar variable
Volker Lendecke [Thu, 12 Sep 2024 19:33:54 +0000 (21:33 +0200)] 
auth: Fix CID 1615191 Uninitialized scalar variable

Protect against winbind successfully returning 0 groups

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 20 18:25:54 UTC 2024 on atb-devel-224

10 months agoctdb: Fix a typo
Volker Lendecke [Wed, 18 Sep 2024 16:29:56 +0000 (18:29 +0200)] 
ctdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agoctdb: Use str_list_add_printf() in debug_locks_args()
Volker Lendecke [Thu, 19 Sep 2024 15:32:42 +0000 (17:32 +0200)] 
ctdb: Use str_list_add_printf() in debug_locks_args()

Saves lines, str_list_add_printf takes care of NULL checks

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agoctdb: Make ctdb_lock_timeout_handler() easier to understand
Volker Lendecke [Thu, 19 Sep 2024 15:10:58 +0000 (17:10 +0200)] 
ctdb: Make ctdb_lock_timeout_handler() easier to understand

Don't hide the real action inside an if-branch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agolib: Avoid unused includes
Volker Lendecke [Wed, 18 Sep 2024 14:57:02 +0000 (16:57 +0200)] 
lib: Avoid unused includes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agovfs: Simplify capdecode() with hex_byte()
Volker Lendecke [Tue, 10 Sep 2024 07:59:54 +0000 (09:59 +0200)] 
vfs: Simplify capdecode() with hex_byte()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agovfs: Simplify capencode() with nybble_to_hex_lower()
Volker Lendecke [Tue, 10 Sep 2024 07:55:36 +0000 (09:55 +0200)] 
vfs: Simplify capencode() with nybble_to_hex_lower()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agopassdb: Simplify pdb_gethexhours() with hex_byte()
Volker Lendecke [Tue, 10 Sep 2024 06:55:16 +0000 (08:55 +0200)] 
passdb: Simplify pdb_gethexhours() with hex_byte()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agolibsmb: Use nybble_to_hex_upper() in virusfilter_url_quote()
Volker Lendecke [Tue, 10 Sep 2024 06:52:16 +0000 (08:52 +0200)] 
libsmb: Use nybble_to_hex_upper() in virusfilter_url_quote()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agolibsmb: Use nybble_to_hex_upper() in smbc_urlencode()
Volker Lendecke [Tue, 10 Sep 2024 06:50:16 +0000 (08:50 +0200)] 
libsmb: Use nybble_to_hex_upper() in smbc_urlencode()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agolibndr: Use TALLOC_FREE instead of talloc_free
Volker Lendecke [Thu, 12 Sep 2024 14:18:57 +0000 (16:18 +0200)] 
libndr: Use TALLOC_FREE instead of talloc_free

All the existing calls are right before returns, so they don't really
matter. But you never know when the code will change, and any compiler
will wipe the NULL assignment.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agorpc_host: Fix max_workers calculation
Volker Lendecke [Sat, 14 Sep 2024 13:21:49 +0000 (15:21 +0200)] 
rpc_host: Fix max_workers calculation

To limit max_workers into 16 bits, cap it at UINT16_MAX (65535, not 65536)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agorpc_server: Fix a comment
Volker Lendecke [Sat, 14 Sep 2024 11:37:13 +0000 (13:37 +0200)] 
rpc_server: Fix a comment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
10 months agos3:utils: use the correct secrets.tdb in net_use_krb_machine_account()
Stefan Metzmacher [Wed, 11 Sep 2024 16:21:58 +0000 (18:21 +0200)] 
s3:utils: use the correct secrets.tdb in net_use_krb_machine_account()

On a cluster we need to use the ctdb controlled database and not
a local secrets.tdb...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Sep 20 05:54:43 UTC 2024 on atb-devel-224

10 months agos3:utils: let 'net ads testjoin' fail without valid machine credentials
Stefan Metzmacher [Wed, 18 Sep 2024 21:48:00 +0000 (23:48 +0200)] 
s3:utils: let 'net ads testjoin' fail without valid machine credentials

This will allow doing tests and make sure using anonymous credentials
doesn't cause false positive results...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
10 months agos3:test_update_keytab_clustered: add net ads testjoin checks in more places
Stefan Metzmacher [Wed, 18 Sep 2024 22:14:56 +0000 (00:14 +0200)] 
s3:test_update_keytab_clustered: add net ads testjoin checks in more places

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
10 months agosmbd: SMB3 POSIX Extensions statfs() is broken
Ralph Boehme [Mon, 29 Apr 2024 16:38:10 +0000 (18:38 +0200)] 
smbd: SMB3 POSIX Extensions statfs() is broken

Regression introduced by 55d98b29eb294542cc4947573f233e0d5e6966cb. D'oh!

We'll add a regression test for this soon,
but for now we want to unblocking testing from the linux
client...

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Sep 19 21:27:07 UTC 2024 on atb-devel-224

10 months agosmbd: remove just created sharemode entry in the error codepaths
Ralph Boehme [Tue, 9 Apr 2024 12:53:32 +0000 (14:53 +0200)] 
smbd: remove just created sharemode entry in the error codepaths

Without this we leave stale sharemode entries around that can lead to all sorts
of havoc.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Sep 19 19:36:19 UTC 2024 on atb-devel-224

10 months agosmbd: consolidate DH reconnect failure code
Ralph Boehme [Tue, 9 Apr 2024 12:52:44 +0000 (14:52 +0200)] 
smbd: consolidate DH reconnect failure code

No change in behaviour, except that we now
also call fd_close() if vfs_default_durable_cookie()
failed.

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agos3:tests: let test_durable_handle_reconnect.sh run smb2.durable-v2-regressions.durabl...
Stefan Metzmacher [Mon, 26 Aug 2024 12:42:12 +0000 (14:42 +0200)] 
s3:tests: let test_durable_handle_reconnect.sh run smb2.durable-v2-regressions.durable_v2_reconnect_bug15624

This demonstrates the dead lock after a durable reconnect failed
because the stat info changed, the file can't be accessed anymore
as we leak the incomplete share mode entry in a still running
process.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agos4:torture/smb2: add smb2.durable-v2-regressions.durable_v2_reconnect_bug15624
Stefan Metzmacher [Mon, 26 Aug 2024 12:42:02 +0000 (14:42 +0200)] 
s4:torture/smb2: add smb2.durable-v2-regressions.durable_v2_reconnect_bug15624

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_error_inject: add 'error_inject:durable_reconnect = st_ex_nlink'
Stefan Metzmacher [Mon, 26 Aug 2024 12:11:02 +0000 (14:11 +0200)] 
vfs_error_inject: add 'error_inject:durable_reconnect = st_ex_nlink'

This allows to simulate durable reconnect failures because the stat
information of the file changed.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agosmbd: add option "smbd:debug events" for tevent handling duration threshold warnings
Ralph Boehme [Wed, 20 Mar 2024 13:28:43 +0000 (14:28 +0100)] 
smbd: add option "smbd:debug events" for tevent handling duration threshold warnings

Can be used to enable printing an error message if tevent event handlers ran
longer then three seconds. Also logs a message with a loglevel of 3 if there
were no events at hall.

Enabled by default with 'log level = 10' or
'smbd profiling level = on'...

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agosmbd: move trace_state variable behind tv variable
Ralph Boehme [Wed, 20 Mar 2024 13:27:27 +0000 (14:27 +0100)] 
smbd: move trace_state variable behind tv variable

Next commit adds timestamp variables to trace_state that want to be initialized
with the current time, so moving behind tv we can then just reuse tv for that.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agosmbd: add option "smbd lease break:debug hung procs"
Ralph Boehme [Thu, 4 Apr 2024 17:18:19 +0000 (19:18 +0200)] 
smbd: add option "smbd lease break:debug hung procs"

By enabling this a process sending a lease break message to another process
holding a lease will start watching that process and if that process didn't
process the lease break within 10 seconds (cf server_id_watch_waited()), we log
a kernel stack backtrace of that process.

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agosmbd: log share_mode_watch_recv() errors as errors
Ralph Boehme [Fri, 5 Apr 2024 10:15:28 +0000 (12:15 +0200)] 
smbd: log share_mode_watch_recv() errors as errors

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agos3/lib: add option "serverid watch:debug script"
Ralph Boehme [Thu, 25 Apr 2024 13:17:08 +0000 (15:17 +0200)] 
s3/lib: add option "serverid watch:debug script"

This takes just PID and NODE:PID on a cluster.

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agos3/lib: add option "serverid watch:debug = yes" to print kernel stack of hanging...
Ralph Boehme [Thu, 4 Apr 2024 10:31:05 +0000 (12:31 +0200)] 
s3/lib: add option "serverid watch:debug = yes" to print kernel stack of hanging process

We only do if sys_have_proc_fds() returns true, so it's most likely
linux...

Enabled by default with log level 10...

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agos3/lib: add next helper variable in server_id_watch_*
Ralph Boehme [Thu, 25 Apr 2024 13:24:57 +0000 (15:24 +0200)] 
s3/lib: add next helper variable in server_id_watch_*

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

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agos4:lib/messaging: fix interaction between imessaging_reinit and irpc_destructor
Stefan Metzmacher [Tue, 17 Sep 2024 06:29:42 +0000 (08:29 +0200)] 
s4:lib/messaging: fix interaction between imessaging_reinit and irpc_destructor

This was missing in commit 0d096931196524a2d1bf59470bc629dc9231131e.

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

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 Sep 18 19:45:56 UTC 2024 on atb-devel-224

10 months agos4: torture: Add a new test lease_rename_with_overwrite.
Jeremy Allison [Tue, 17 Sep 2024 18:47:31 +0000 (11:47 -0700)] 
s4: torture: Add a new test lease_rename_with_overwrite.

Creates and opens two files with leases, then tries
rename-with-overwrite on file_src -> file_dst.

Ensures we get a lease break on file_dst before
getting the access denied response.

Passes against Windows, fails against Samba.

Add knownfail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Sep 18 05:42:15 UTC 2024 on atb-devel-224

10 months agosync machine password to keytab: handle FreeIPA use case
Alexander Bokovoy [Tue, 3 Sep 2024 05:48:24 +0000 (08:48 +0300)] 
sync machine password to keytab: handle FreeIPA use case

FreeIPA uses own procedure to retrieve keytabs and during the setup of
Samba on FreeIPA client the keytab is already present, only machine
account needs to be set in the secrets database.

'sync machine password to keytab' option handling broke this use case by
always attempting to contact a domain controller and failing to do so
(Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=2309199).

The original synchronizing machine account password to keytab feature
did not have a mechanism to disable its logic at all.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Fri Sep 13 13:16:09 UTC 2024 on atb-devel-224

10 months agodocs_xml/vfs_ceph_new: Add new proxy option
Anoop C S [Thu, 5 Sep 2024 06:15:19 +0000 (11:45 +0530)] 
docs_xml/vfs_ceph_new: Add new proxy option

Update man page to describe new 'proxy' module option.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Thu Sep 12 16:51:14 UTC 2024 on atb-devel-224

10 months agowscript_build: Do not link vfs_ceph_new against libcephfs
Anoop C S [Sun, 8 Sep 2024 07:22:59 +0000 (12:52 +0530)] 
wscript_build: Do not link vfs_ceph_new against libcephfs

vfs_ceph_new dynamically loads the appropriate libcephfs shared
libraries which means that we don't statically link against it.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Use function pointers for API calls
Anoop C S [Thu, 5 Sep 2024 09:50:28 +0000 (15:20 +0530)] 
vfs_ceph_new: Use function pointers for API calls

Replace direct function calls with pointers holding their equivalent
addresses.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Pass module config to userperm helpers
Anoop C S [Thu, 5 Sep 2024 09:46:54 +0000 (15:16 +0530)] 
vfs_ceph_new: Pass module config to userperm helpers

userperm helpers will switch to function references instead of direct
invocation of APIs. This would mean the matching config structure is
passed to those helpers.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Hold a config reference in vfs_ceph_fh
Anoop C S [Thu, 5 Sep 2024 08:31:37 +0000 (14:01 +0530)] 
vfs_ceph_new: Hold a config reference in vfs_ceph_fh

This is required to perform the cleanup when fsp extension destructor is
called as part of VFS_REMOVE_FSP_EXTENSION where mount information and
function references are to be used in upcoming changes.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Call vfs_ceph_userperm_new with handle->conn
Anoop C S [Thu, 5 Sep 2024 09:20:48 +0000 (14:50 +0530)] 
vfs_ceph_new: Call vfs_ceph_userperm_new with handle->conn

vfs_ceph_userperm_new() only need connection structure from handle
for fetching the current unix token. Therefore modify the signature
to accept just handle->conn.

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Populate function pointers with addresses
Guenther Deschner [Thu, 5 Sep 2024 08:10:27 +0000 (13:40 +0530)] 
vfs_ceph_new: Populate function pointers with addresses

Use dlysm() for assigning addresses to already declared libcephfs
low-level API function pointers.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Add required function pointers to config
Guenther Deschner [Thu, 5 Sep 2024 08:01:13 +0000 (13:31 +0530)] 
vfs_ceph_new: Add required function pointers to config

Declare necessary libcephfs low-level APIs as function pointers to be
assigned with corresponding loadable addresses.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Dynamically open library for 'proxy' mode
Guenther Deschner [Thu, 5 Sep 2024 07:49:52 +0000 (13:19 +0530)] 
vfs_ceph_new: Dynamically open library for 'proxy' mode

Use dlopen() to load either of the shared libraries(libcephfs.so or
libcephfs_proxy.so) based on the configuration for 'proxy' module
parameter. Further down the line we will define the required APIs
as function pointers within the config structure.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Introduce new parametric option 'proxy'
Guenther Deschner [Thu, 5 Sep 2024 07:43:38 +0000 (13:13 +0530)] 
vfs_ceph_new: Introduce new parametric option 'proxy'

Provide early support for consuming yet to come libcephfs proxy[1] for
optimized resource utilization. For better control we make use of an
additional module specific option 'proxy' to specify the intent to load
proxy library. With the default value 'no' a regular cephfs connection
is established. There is also an 'auto' mode which can fall back to the
regular connection if proxy requirements are not met.

[1] https://github.com/ceph/ceph/pull/58376

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

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: Add a new struct to hold ceph module config
Guenther Deschner [Thu, 5 Sep 2024 06:49:52 +0000 (12:19 +0530)] 
vfs_ceph_new: Add a new struct to hold ceph module config

Consolidate all required configuration related data under a dedicated
structure named vfs_ceph_config. As of now it includes the location of
configuration file, file system name, ceph client user id and mount
related information. This is expected to grow in future with more
details as and when required. Apart from that small cleanups are also
done to make code more robust.

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

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
10 months agovfs_ceph_new: implement DFS hooks using libcephfs low-level APIs
Shachar Sharon [Mon, 12 Aug 2024 11:45:53 +0000 (14:45 +0300)] 
vfs_ceph_new: implement DFS hooks using libcephfs low-level APIs

Refactor the VFS hooks 'create_dfs_pathat_fn' and 'read_dfs_pathat_fn'
in 'vfs_ceph_new.c' to use libcephfs low-level APIs: instead of using
path-based operations (as done in legacy 'vfs_ceph.c') use inode based
operations to create and read msdfs symbolic-links values.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Sep 11 19:09:41 UTC 2024 on atb-devel-224

10 months agolibndr: Apply endianness flags to subndr
Volker Lendecke [Fri, 30 Aug 2024 15:03:38 +0000 (17:03 +0200)] 
libndr: Apply endianness flags to subndr

We're creating a fresh subcontext for a "[MS-RPCE] 2.2.6 Type
Serialization Version 1". Probably nobody has tested a big endian
subcontext yet.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Sep 10 23:04:19 UTC 2024 on atb-devel-224

10 months agolibndr: Align an integer type
Volker Lendecke [Thu, 29 Aug 2024 14:41:21 +0000 (16:41 +0200)] 
libndr: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agolibndr: Use UINT32_MAX -- no need to count F's
Volker Lendecke [Thu, 29 Aug 2024 09:41:07 +0000 (11:41 +0200)] 
libndr: Use UINT32_MAX -- no need to count F's

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agolibndr: Remove duplicate prototype
Volker Lendecke [Mon, 26 Aug 2024 13:32:20 +0000 (15:32 +0200)] 
libndr: Remove duplicate prototype

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agolibndr: We don't need "../" in includes, -I has what is needed
Volker Lendecke [Mon, 26 Aug 2024 10:04:20 +0000 (12:04 +0200)] 
libndr: We don't need "../" in includes, -I has what is needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agoutil: Make show_msg call DEBUG just once
Volker Lendecke [Mon, 17 Jun 2024 11:08:47 +0000 (13:08 +0200)] 
util: Make show_msg call DEBUG just once

format_debug_text() still splits up lines with separate write-calls, but
DEBUGADD is something that I would like to get rid of.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agolib: Align integer types
Volker Lendecke [Mon, 5 Aug 2024 08:31:35 +0000 (10:31 +0200)] 
lib: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agotests: Improve the error message for bad format chars
Volker Lendecke [Thu, 5 Sep 2024 11:06:23 +0000 (13:06 +0200)] 
tests: Improve the error message for bad format chars

Print the faulty character for easier finding it.

I did not find out how to split the format string into two lines such
that self.fail would properly print the whole thing in its exception,
so we have a long line here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
10 months agolibrpc/ndr: Fix fuzz CI on latest tumbleweed
Noel Power [Mon, 9 Sep 2024 13:58:26 +0000 (14:58 +0100)] 
librpc/ndr: Fix fuzz CI on latest tumbleweed

running samba-fuzz CI job on latest tumbleweed docker image results in;

../../librpc/ndr/ndr_orpc.c: In function ‘ndr_print_DUALSTRINGARRAY’:
../../librpc/ndr/ndr_orpc.c:97:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
   97 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                                                 ^
../../librpc/ndr/ndr_orpc.c:97:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 13
   97 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../librpc/ndr/ndr_orpc.c:105:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  105 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                                                 ^
../../librpc/ndr/ndr_orpc.c:105:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 13
  105 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../librpc/ndr/ndr_orpc.c: In function ‘ndr_print_STRINGARRAY’:
../../librpc/ndr/ndr_orpc.c:159:49: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  159 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                                                 ^
../../librpc/ndr/ndr_orpc.c:159:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 13
  159 |                 snprintf(idx, sizeof(idx), "[%d]", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Sep 10 01:22:28 UTC 2024 on atb-devel-224

10 months agonetcmd: user: Fix typo in samba-tool error message
Lyanis Souidi [Mon, 9 Sep 2024 14:34:19 +0000 (16:34 +0200)] 
netcmd: user: Fix typo in samba-tool error message

Fix typo in "samba-tool user add" error message when adding a user with
NIS features : the argument for the uid number is --uid-number and not
--uidNumber.

RN: Fix typo in samba-tool error message.

Signed-off-by: Lyanis Souidi <lyanis.souidi@u-pec.fr>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
11 months agolibsecurity: Simplify struct ace_condition_script
Volker Lendecke [Wed, 4 Sep 2024 15:13:44 +0000 (17:13 +0200)] 
libsecurity: Simplify struct ace_condition_script

We only need the stack temporarily, no reason to put it in the struct

Signed-off-by: Volker Lendecke <vl@samba.org>
Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Sep  6 14:23:58 UTC 2024 on atb-devel-224

11 months agoREADME: Add languages to code blocks for highlighting
Andreas Schneider [Fri, 28 Jun 2024 11:01:24 +0000 (13:01 +0200)] 
README: Add languages to code blocks for highlighting

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Sep  5 14:27:30 UTC 2024 on atb-devel-224

11 months agosmbd: improve reinit_after_fork error handling
David Disseldorp [Wed, 4 Sep 2024 02:54:09 +0000 (02:54 +0000)] 
smbd: improve reinit_after_fork error handling

reinit_after_fork() may panic or return an error on failure. When smbd
is started in interactive mode, it ignores the reinit_after_fork()
return status and unconditionally proceeds to smbd_process().

Similarly, if messaging_reinit() fails within reinit_after_fork() then
it will subsequently call ctdb_async_ctx_reinit() if clustering is
enabled.

There's no reason why these errors shouldn't be handled immediately, so
add appropriate error handling.

Found by code inspection; not seen in the wild.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Sep  4 09:53:01 UTC 2024 on atb-devel-224

11 months agosmbd: use metadata_fsp(fsp) in copy_access_posix_acl() for SMB_VFS_SYS_ACL_SET_FD
Ralph Boehme [Fri, 5 Jul 2024 14:22:18 +0000 (16:22 +0200)] 
smbd: use metadata_fsp(fsp) in copy_access_posix_acl() for SMB_VFS_SYS_ACL_SET_FD

When inherting permissions on the created stream, we call into the VFS to fetch
the streams security descriptor via inherit_access_posix_acl() ->
copy_access_posix_acl() -> SMB_VFS_SYS_ACL_SET_FD() passing the stream fsp which
triggers the assert SMB_ASSERT(!fsp_is_alternate_stream(fsp)) in
vfswrap_sys_acl_set_fd() in vfs_default.

Just passing the base fsp to the VFS fixes this.

vfs_streams_depot which *does use* distinct backend filesystem files for the
streams, currently does not apply permissions to the stream files at all, so the
incomplete behaviour of vfs_streams_depot is not affected by this change.

If in the future someone want to fix this defficiency in vfs_streams_depot, the
module code can use fsp->stream_fsp to base decisions in VFS ops whether the
module should carry out some action.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep  2 08:55:28 UTC 2024 on atb-devel-224

11 months agosmbtorture: test creating stream doesn't crash when using "inherit permissions =...
Ralph Boehme [Sat, 6 Jul 2024 15:10:21 +0000 (17:10 +0200)] 
smbtorture: test creating stream doesn't crash when using "inherit permissions = yes"

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agovfs_ceph_new: handle case of readlinkat with empty name string
Shachar Sharon [Tue, 20 Aug 2024 09:45:07 +0000 (12:45 +0300)] 
vfs_ceph_new: handle case of readlinkat with empty name string

Commit 53c9269b (vfs_ceph_new: use low-level APIs for symlink/readlink)
introduced readlinkat using libcephfs low-level APIs. However, it does
not handle properly the case where readlinkat operates on empty name
string (see man readlinkat(2)), such as:

  fd = openat(dirfd, symname, O_PATH | O_NOFOLLOW, 0);
  readlinkat(fd, "", buf, bufsiz);

Handle this special case of readlinkat with empty name string by using
a reference to the symlink inode itself.

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

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Aug 30 10:42:27 UTC 2024 on atb-devel-224

11 months agoctdb-tests: Add persistent TDB backup tests
Martin Schwenke [Wed, 10 Apr 2024 06:55:01 +0000 (16:55 +1000)] 
ctdb-tests: Add persistent TDB backup tests

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Aug 30 00:08:41 UTC 2024 on atb-devel-224

11 months agoctdb-scripts: Add support for backing up persistent TDBs
Martin Schwenke [Fri, 5 Apr 2024 06:12:40 +0000 (17:12 +1100)] 
ctdb-scripts: Add support for backing up persistent TDBs

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 months agoctdb-scripts: Move database handling to its own event script
Martin Schwenke [Mon, 8 Apr 2024 01:15:24 +0000 (11:15 +1000)] 
ctdb-scripts: Move database handling to its own event script

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 months agoctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"
Martin Schwenke [Mon, 8 Apr 2024 01:08:33 +0000 (11:08 +1000)] 
ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 months agoctdb-scripts: Remove unused variable NFS_HOSTNAME
Martin Schwenke [Wed, 1 May 2024 00:22:05 +0000 (10:22 +1000)] 
ctdb-scripts: Remove unused variable NFS_HOSTNAME

This was passed to CTDB's old smnotify.  This has been replaced by use
of nfs-utils' sm-notify, which doesn't need this.

In test, a fake NFS_HOSTNAME is still needed.  Real sm-notify will get
it from a reverse host lookup of the IP address.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 months agoctdb-scripts: Use nfs-utils' sm-notify instead of CTDB's smnotify
Martin Schwenke [Fri, 3 Mar 2017 04:44:08 +0000 (15:44 +1100)] 
ctdb-scripts: Use nfs-utils' sm-notify instead of CTDB's smnotify

CTDB's smnotify does not support IPv6 and is difficult to maintain.

So, create directories of files and pass them to NFS util's sm-notify.

There is an implied change here, because NFS utils sm-notify stopped
sending IP addresses as mon_name back in 2010:

  http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=900df0e7c0b9006d72d8459b30dc2cd69ce495a5

This will change advice given in the wiki to use a hostname for the
cluster with round-robin DNS, since this is what is best supported.

Another behavioural change is that sm-notify only sends "up"
notifications with an odd state.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 months agoctdb-failover: Add ctdb_smnotify_helper
Martin Schwenke [Wed, 10 May 2023 02:21:07 +0000 (12:21 +1000)] 
ctdb-failover: Add ctdb_smnotify_helper

statd callout will shortly be updated to use NFS utils' sm-notify.
This tiny helper will be used to create on-disk state files used by
sm-notify.  These state files contain endian-specific fields, so
better to write a simple C implementation than to do crazy things in a
shell script (or call out to Python).

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
11 months agos4:torture/smb2: better error handling in create.c
Stefan Metzmacher [Thu, 25 Jul 2024 09:58:37 +0000 (11:58 +0200)] 
s4:torture/smb2: better error handling in create.c

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

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): Thu Aug 29 19:47:54 UTC 2024 on atb-devel-224

11 months agos4:torture/raw: better error handling in streams.c
Stefan Metzmacher [Thu, 25 Jul 2024 09:06:18 +0000 (11:06 +0200)] 
s4:torture/raw: better error handling in streams.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agos4:torture/smb2: make use of torture_assert_*_equal_goto() in streams.c
Stefan Metzmacher [Mon, 8 Jul 2024 07:05:49 +0000 (09:05 +0200)] 
s4:torture/smb2: make use of torture_assert_*_equal_goto() in streams.c

We should fail immediately...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agos4:libcli/smb2: let smb2_deltree delete directory streams
Stefan Metzmacher [Thu, 18 Jul 2024 14:22:55 +0000 (16:22 +0200)] 
s4:libcli/smb2: let smb2_deltree delete directory streams

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agos4:libcli: allow smb2_composite_unlink* to truncate the file before close
Stefan Metzmacher [Tue, 30 Jul 2024 14:33:15 +0000 (16:33 +0200)] 
s4:libcli: allow smb2_composite_unlink* to truncate the file before close

This is needed to delete streams...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agos3:tests: make use of TMPDIR in test_symlink_traversal_*.sh
Stefan Metzmacher [Wed, 7 Aug 2024 14:28:22 +0000 (16:28 +0200)] 
s3:tests: make use of TMPDIR in test_symlink_traversal_*.sh

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agolib/torture: add torture_assert_nttime_equal_goto()
Stefan Metzmacher [Tue, 30 Jul 2024 11:57:25 +0000 (13:57 +0200)] 
lib/torture: add torture_assert_nttime_equal_goto()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agolibrpc/ndr: remove unused NDR_PUSH_ALLOC_SIZE()
Stefan Metzmacher [Thu, 29 Aug 2024 11:27:48 +0000 (13:27 +0200)] 
librpc/ndr: remove unused NDR_PUSH_ALLOC_SIZE()

Pair-Programmed-With: Volker Lendecke <vl@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agolibrpc/ndr: avoid alignment allocation in ndr_push_DATA_BLOB()
Stefan Metzmacher [Thu, 29 Aug 2024 11:26:04 +0000 (13:26 +0200)] 
librpc/ndr: avoid alignment allocation in ndr_push_DATA_BLOB()

Pair-Programmed-With: Volker Lendecke <vl@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 months agolibndr: Streamline ndr_token_retrieve_cmp_fn
Volker Lendecke [Wed, 28 Aug 2024 10:32:45 +0000 (12:32 +0200)] 
libndr: Streamline ndr_token_retrieve_cmp_fn

Rename the public function to ndr_token_peek_cmp_fn, the only user
does not remove the token. Factor out ndr_token_find to move the
token-removing logic to ndr_token_retrieve, the only caller that does
remove the token.

Keep libndr at 6.0.0, this has not been released yet.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Aug 29 08:40:52 UTC 2024 on atb-devel-224

11 months agolibndr: Simplify ndr_token_retrieve_cmp_fn()
Volker Lendecke [Wed, 28 Aug 2024 10:08:57 +0000 (12:08 +0200)] 
libndr: Simplify ndr_token_retrieve_cmp_fn()

Avoid an if-statement inside by passing a pointer-comparing function

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agolibcli/smb: Fix failure of Smb3UnixTests.test_create_context_reparse
Noel Power [Wed, 28 Aug 2024 15:19:27 +0000 (16:19 +0100)] 
libcli/smb: Fix failure of Smb3UnixTests.test_create_context_reparse

On tumbleweed at least the definition in py_reparse_put of 'reserved' as
'unsigned' causes the tag value to be overwritten. Note: ParseTuple is
given a format of 'Kk' where
  K = unsigned long long (for tag)
  k = unsigned long      (for reserved)

The problem is 'reserved' is defined as 'unsigned' which on a
64 bit linux system has size 4. The size however of the 'unsigned long' type
on the same 64 bit system is 8. This causes 'tag' to be overwritten by
the value of 'reserved' because it's destination size is smaller than
expected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15702
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Aug 28 18:38:01 UTC 2024 on atb-devel-224

11 months agosmb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses
David Disseldorp [Fri, 23 Aug 2024 12:55:58 +0000 (12:55 +0000)] 
smb2_ioctl: fix truncated FSCTL_QUERY_ALLOCATED_RANGES responses

As per MS-FSA 2.1.5.10.22 FSCTL_QUERY_ALLOCATED_RANGES, if response
range entries exceed in_max_output, then we should respond with
STATUS_BUFFER_OVERFLOW and a truncated output buffer.

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

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Aug 28 08:54:11 UTC 2024 on atb-devel-224

11 months agos4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation
David Disseldorp [Fri, 23 Aug 2024 13:01:24 +0000 (13:01 +0000)] 
s4:torture/smb2: test FSCTL_QUERY_ALLOCATED_RANGES truncation

FSCTL_QUERY_ALLOCATED_RANGES responses with more than one range should
be truncated to account for a ioctl.smb2.in.max_output_response limit.
Add a test for this.

Flag the new test knownfail; fix in subsequent commit.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
11 months agodsdb:cracknames: free more on error (CID 240724)
Douglas Bagnall [Wed, 31 Jul 2024 01:39:46 +0000 (13:39 +1200)] 
dsdb:cracknames: free more on error (CID 240724)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Aug 28 05:39:36 UTC 2024 on atb-devel-224

11 months agodsdb:util: dsdb_module_dn initialises on failure
Douglas Bagnall [Wed, 31 Jul 2024 01:31:02 +0000 (13:31 +1200)] 
dsdb:util: dsdb_module_dn initialises on failure

I think this may be a root cause of some Coverity false positives.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agodsdb:mod:operational: initialise a pointer (CID 1499411)
Douglas Bagnall [Wed, 31 Jul 2024 01:27:40 +0000 (13:27 +1200)] 
dsdb:mod:operational: initialise a pointer (CID 1499411)

A Coverity false positive (we check for error) but it is worth
doing per README.Coding

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agondr:dnsp: avoid theoretical int overflow (CID 1609418)
Douglas Bagnall [Tue, 30 Jul 2024 22:41:54 +0000 (10:41 +1200)] 
ndr:dnsp: avoid theoretical int overflow (CID 1609418)

Coverity points out that if the string is longer than INT_MAX, the int
will overflow and the cast to uint8_t will discard bits.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agoldb:kv_index: help static analysers to not worry (CID 1615192)
Douglas Bagnall [Tue, 30 Jul 2024 21:20:50 +0000 (09:20 +1200)] 
ldb:kv_index: help static analysers to not worry (CID 1615192)

The point of this realloc is that we are not using this array, but
keeping it around to remain a node the talloc tree. We'd prefer to
reduce it to nothing.

Coverity rightly spotted that it was reallocing an array of `struct
ldb_val` to an array of `struct ldb_val *`, which has a different size
and all. But it doesn't matter in this case, because we will never use
it.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agos4:drs:test:getncchanges skips some tests with reserved_usn = 0
Douglas Bagnall [Thu, 8 Aug 2024 23:48:06 +0000 (11:48 +1200)] 
s4:drs:test:getncchanges skips some tests with reserved_usn = 0

These tests are not affected by the reserved_usn change, so there is
no need to run them twice.

The test_repl_get_tgt_multivalued_links fails with or without
reserved_usn set to zero, but it fails differently in either case.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agos4:drs:test:getncchanges: remove timeout failure
Douglas Bagnall [Thu, 8 Aug 2024 23:29:11 +0000 (11:29 +1200)] 
s4:drs:test:getncchanges: remove timeout failure

We don't need a timeout failure any more, since replication should
always work. Leaving the timeout in might sometimes cause a flapping
test if replication is being slow for some reason.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agos4:drsuapi:getncchanges: allow 0 reserved_usn reply
Douglas Bagnall [Wed, 7 Aug 2024 05:25:30 +0000 (17:25 +1200)] 
s4:drsuapi:getncchanges: allow 0 reserved_usn reply

Azure AD will set reserved_usn to zero when we expect it to be
the number we gave them.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agos4:drsuapi:getncchanges: use DBG_ERR() macro
Douglas Bagnall [Thu, 13 Jun 2024 05:23:23 +0000 (17:23 +1200)] 
s4:drsuapi:getncchanges: use DBG_ERR() macro

The next commit will indent this more, so it's a bit squished up.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agos4:drsuapi:getncchanges: fix whitespace
Douglas Bagnall [Wed, 7 Aug 2024 05:05:48 +0000 (17:05 +1200)] 
s4:drsuapi:getncchanges: fix whitespace

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>
11 months agos4:drs:tests: repeat getncchanges test with zero reserved_usn
Douglas Bagnall [Wed, 14 Aug 2024 01:26:37 +0000 (13:26 +1200)] 
s4:drs:tests: repeat getncchanges test with zero reserved_usn

This emulates the behaviour of Azure AD.

As this is quite slow we will later reduce the test load in this case,
but for now we want to run all the getncchanges tests this way.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <josutton@catalyst.net.nz>