]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 months agos4:torture: Add notify test for 'smb2 max async credits'
Andreas Schneider [Thu, 1 Aug 2024 10:45:14 +0000 (12:45 +0200)] 
s4:torture: Add notify test for 'smb2 max async credits'

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
6 months agos3:torture: Add IPC test with multichannel for 'smb2 max async credits'
Andreas Schneider [Mon, 26 Aug 2024 08:53:06 +0000 (10:53 +0200)] 
s3:torture: Add IPC test with multichannel for 'smb2 max async credits'

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 months agos4:torture: Add IPC test with 2 connections for 'smb2 max async credits'
Andreas Schneider [Mon, 26 Aug 2024 08:29:23 +0000 (10:29 +0200)] 
s4:torture: Add IPC test with 2 connections for 'smb2 max async credits'

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 months agos4:torture: Add IPC test for 'smb2 max async credits'
Andreas Schneider [Sat, 27 Jul 2024 15:14:42 +0000 (17:14 +0200)] 
s4:torture: Add IPC test for 'smb2 max async credits'

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
6 months agos4:libcli/smb2: add smb2_tree_channel() helper
Stefan Metzmacher [Fri, 9 Aug 2024 07:07:40 +0000 (09:07 +0200)] 
s4:libcli/smb2: add smb2_tree_channel() helper

This can be used after smb2_session_channel() in order
to have a smb2_tree structure representing the same
logic tree connect but uses a different channel/connection.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 months agolibcli:smb: Implement smb2cli_notify_set_notify_async()
Andreas Schneider [Fri, 23 Aug 2024 09:46:33 +0000 (11:46 +0200)] 
libcli:smb: Implement smb2cli_notify_set_notify_async()

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
6 months agolibcli:smb: Implement smb2cli_read_cancel()
Andreas Schneider [Wed, 28 Aug 2024 13:06:11 +0000 (15:06 +0200)] 
libcli:smb: Implement smb2cli_read_cancel()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 months agolibcli:smb: Implement smb2cli_read_set_notify_async()
Stefan Metzmacher [Mon, 5 Aug 2024 07:16:58 +0000 (09:16 +0200)] 
libcli:smb: Implement smb2cli_read_set_notify_async()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 months agos4:librpc: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) in dcerpc_bh_do_ndr_print()
Stefan Metzmacher [Tue, 5 Jun 2018 02:56:02 +0000 (04:56 +0200)] 
s4:librpc: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) in dcerpc_bh_do_ndr_print()

This makes sure the debug class rpc_parse is used for ndr dump output.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Jan 29 02:11:51 UTC 2025 on atb-devel-224

6 months agos4:lib/messaging: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) in irpc_bh_do_ndr_...
Stefan Metzmacher [Tue, 5 Jun 2018 02:56:02 +0000 (04:56 +0200)] 
s4:lib/messaging: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) in irpc_bh_do_ndr_print()

This makes sure the debug class rpc_parse is used for ndr dump output.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agos3:winbindd: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) in wbint_bh_do_ndr_print()
Stefan Metzmacher [Tue, 5 Jun 2018 02:56:02 +0000 (04:56 +0200)] 
s3:winbindd: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) in wbint_bh_do_ndr_print()

This makes sure the debug class rpc_parse is used for ndr dump output.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agos3:rpc_client: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) rpccli_bh_do_ndr_print
Stefan Metzmacher [Tue, 5 Jun 2018 02:56:02 +0000 (04:56 +0200)] 
s3:rpc_client: make use of CHECK_DEBUGLVLC(DBGC_RPC_PARSE, ...) rpccli_bh_do_ndr_print

This makes sure the debug class rpc_parse is used for ndr dump output.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agos3:rpc_server:lsa: make use of the lib/util version of dns_cmp()
Stefan Metzmacher [Tue, 5 Jun 2018 01:28:09 +0000 (03:28 +0200)] 
s3:rpc_server:lsa: make use of the lib/util version of dns_cmp()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agodsdb:util_trusts: remove unused copy of dns_cmp()
Stefan Metzmacher [Tue, 5 Jun 2018 01:21:39 +0000 (03:21 +0200)] 
dsdb:util_trusts: remove unused copy of dns_cmp()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agolib/util: add dns_cmp() as it's own file
Stefan Metzmacher [Tue, 5 Jun 2018 01:18:56 +0000 (03:18 +0200)] 
lib/util: add dns_cmp() as it's own file

This is a copy of the function in source4/dsdb/common/util_trusts.c, which will
be removed soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agos4:rpc_server/lsa: let LookupSids* behave like Windows 2022/2025
Stefan Metzmacher [Fri, 10 Mar 2023 14:05:15 +0000 (15:05 +0100)] 
s4:rpc_server/lsa: let LookupSids* behave like Windows 2022/2025

The important part is the INVALID_SID should not
cause an early exit of the loop.

We need to return the intact names array with the
correct count. And only return INVALID_SID
if we would otherwise return NONE_MAPPED.

For SOME_NOT_MAPPED we need to ignore invalid sids
and just pretend they are not mapped.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agolibcli/security: let dom_sid_lookup_predefined_sid() behave like Windows 2008R2
Stefan Metzmacher [Wed, 12 Aug 2020 15:08:14 +0000 (17:08 +0200)] 
libcli/security: let dom_sid_lookup_predefined_sid() behave like Windows 2008R2

Windows 2008R2 (172.31.9.133) returns the following:

 #> rpcclient 172.31.9.133 -Uadministrator%A1b2C3d4 -c 'lookupsids S-1-22-1 S-1-22-1-0;lookupsids S-1-22;lookupsids S-1-3-0 S-1-3-99;lookupsids S-1-3'
 S-1-22-1 *unknown*\*unknown* (8)
 S-1-22-1-0 *unknown*\*unknown* (8)
 result was NT_STATUS_INVALID_SID
 S-1-3-0 \CREATOR OWNER (5)
 S-1-3-99 *unknown*\*unknown* (8)
 result was NT_STATUS_INVALID_SID

While the current Samba (172.31.9.163) returns the following:

 #> rpcclient 172.31.9.163 -Uadministrator%A1b2C3d4 -c 'lookupsids S-1-22-1 S-1-22-1-0;lookupsids S-1-22;lookupsids S-1-3-0 S-1-3-99;lookupsids S-1-3'
 result was NT_STATUS_INVALID_SID
 result was NT_STATUS_INVALID_SID
 S-1-3-0 \CREATOR OWNER (5)
 S-1-3-99 *unknown*\*unknown* (8)
 S-1-3 *unknown*\*unknown* (8)

With this change also return the same as Windows 2008R2:

 #> rpcclient 172.31.9.163 -Uadministrator%A1b2C3d4 -c 'lookupsids S-1-22-1 S-1-22-1-0;lookupsids S-1-22;lookupsids S-1-3-0 S-1-3-99;lookupsids S-1-3'
 S-1-22-1 *unknown*\*unknown* (8)
 S-1-22-1-0 *unknown*\*unknown* (8)
 result was NT_STATUS_INVALID_SID
 S-1-3-0 \CREATOR OWNER (5)
 S-1-3-99 *unknown*\*unknown* (8)
 result was NT_STATUS_INVALID_SID

This is a minimal fix in order to avoid crashes in the Windows Explorer.
The real fix needs more work and additional tests, as the behavior seems
to be different in newer Windows releases.

The following patch will let us behave like Windows 2022/2025...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopython:tests/dcerpc/lsa: add tests for invalid LookupSids2 combinations
Stefan Metzmacher [Tue, 28 Jan 2025 08:51:14 +0000 (09:51 +0100)] 
python:tests/dcerpc/lsa: add tests for invalid LookupSids2 combinations

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agos4:pyrpc: allow connections with raise_result_exceptions=False
Stefan Metzmacher [Tue, 28 Jan 2025 13:57:53 +0000 (14:57 +0100)] 
s4:pyrpc: allow connections with raise_result_exceptions=False

This is needed in order to do useful tests with
specific error codes and still checking all other
out parameters.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: prepare code to avoid NTSTATUS/WERROR exceptions
Stefan Metzmacher [Tue, 28 Jan 2025 13:56:54 +0000 (14:56 +0100)] 
pidl:Python: prepare code to avoid NTSTATUS/WERROR exceptions

They are returned as additional result.

It means callers can look at all out params,
even if the status is an error.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: handle NTSTATUS/WERROR exceptions first
Stefan Metzmacher [Tue, 28 Jan 2025 13:56:54 +0000 (14:56 +0100)] 
pidl:Python: handle NTSTATUS/WERROR exceptions first

If we raise an exception we should not leak temporary
python objects.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: separate logic to calculate the signature string
Stefan Metzmacher [Tue, 28 Jan 2025 09:27:16 +0000 (10:27 +0100)] 
pidl:Python: separate logic to calculate the signature string

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: check PyTuple_New() return value
Stefan Metzmacher [Tue, 28 Jan 2025 09:20:08 +0000 (10:20 +0100)] 
pidl:Python: check PyTuple_New() return value

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: initialize pointers and add 'result' at the end
Stefan Metzmacher [Tue, 28 Jan 2025 09:19:09 +0000 (10:19 +0100)] 
pidl:Python: initialize pointers and add 'result' at the end

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: introduce $is_raisable_return helper variable
Stefan Metzmacher [Tue, 28 Jan 2025 09:07:18 +0000 (10:07 +0100)] 
pidl:Python: introduce $is_raisable_return helper variable

No change in the generated code.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agopidl:Python: generate nicer code for PyNdrRpcMethodDef arrays
Stefan Metzmacher [Tue, 28 Jan 2025 11:02:08 +0000 (12:02 +0100)] 
pidl:Python: generate nicer code for PyNdrRpcMethodDef arrays

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
6 months agodocs: Fix the documentation for NET ADS DNS (UN)REGISTER
Pavel Filipenský [Mon, 27 Jan 2025 16:37:14 +0000 (17:37 +0100)] 
docs: Fix the documentation for NET ADS DNS (UN)REGISTER

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Mon Jan 27 19:20:52 UTC 2025 on atb-devel-224

6 months agos3:selftest: Correctly set smbtorture4 targets
Andreas Schneider [Fri, 17 Jan 2025 10:55:15 +0000 (11:55 +0100)] 
s3:selftest: Correctly set smbtorture4 targets

This is needed that you can correctly skip individual smbtorture4 tests.

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): Mon Jan 27 11:41:40 UTC 2025 on atb-devel-224

6 months agos4:torture: Fix spoolss tests running against Samba
Andreas Schneider [Fri, 17 Jan 2025 17:32:15 +0000 (18:32 +0100)] 
s4:torture: Fix spoolss tests running against Samba

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Fix checking targets in smb2.getinfo
Andreas Schneider [Fri, 17 Jan 2025 13:52:07 +0000 (14:52 +0100)] 
s4:torture: Fix checking targets in smb2.getinfo

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Remove trailing spaces in getinfo.c
Andreas Schneider [Fri, 17 Jan 2025 13:49:27 +0000 (14:49 +0100)] 
s4:torture: Remove trailing spaces in getinfo.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Fix checking targets in raw.streams
Andreas Schneider [Fri, 17 Jan 2025 12:57:03 +0000 (13:57 +0100)] 
s4:torture: Fix checking targets in raw.streams

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Fix target handling in raw.chkpath
Andreas Schneider [Fri, 17 Jan 2025 12:35:40 +0000 (13:35 +0100)] 
s4:torture: Fix target handling in raw.chkpath

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:selftest: Set smbtorture4 targets correctly
Andreas Schneider [Fri, 17 Jan 2025 14:21:13 +0000 (15:21 +0100)] 
s4:selftest: Set smbtorture4 targets correctly

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Skip test_BackupLog against all of Samba
Andreas Schneider [Fri, 17 Jan 2025 16:50:38 +0000 (17:50 +0100)] 
s4:torture: Skip test_BackupLog against all of Samba

This is a Windows test.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Remove obsolete check in raw.close test
Andreas Schneider [Fri, 17 Jan 2025 12:27:52 +0000 (13:27 +0100)] 
s4:torture: Remove obsolete check in raw.close test

This would result in an error as the code misses torture_assert calls.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos4:torture: Remove obsolete test in samba3.session
Andreas Schneider [Fri, 17 Jan 2025 15:45:29 +0000 (16:45 +0100)] 
s4:torture: Remove obsolete test in samba3.session

This test never got executed anyway.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 months agos3/mdssvc: add option "elasticsearch:force_substring_search = yes | no" (default...
Ralph Boehme [Thu, 16 Jan 2025 11:15:37 +0000 (12:15 +0100)] 
s3/mdssvc: add option "elasticsearch:force_substring_search = yes | no" (default: no)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jan 24 10:52:33 UTC 2025 on atb-devel-224

6 months agosmbd: Remove an unnecessary call to SMB_VFS_STAT()
Volker Lendecke [Tue, 31 Dec 2024 11:36:12 +0000 (12:36 +0100)] 
smbd: Remove an unnecessary call to SMB_VFS_STAT()

filename_convert_dirfsp() already takes care of looking up the last
component if it's there.

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): Fri Jan 24 00:06:14 UTC 2025 on atb-devel-224

6 months agosmbd: Make dirfsp param to synthetic_pathref() const
Volker Lendecke [Thu, 2 Jan 2025 13:29:27 +0000 (14:29 +0100)] 
smbd: Make dirfsp param to synthetic_pathref() const

openat_pathref_fsp() only needs const

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Mondernize a few DEBUGs
Volker Lendecke [Wed, 22 Jan 2025 08:08:38 +0000 (09:08 +0100)] 
vfs: Mondernize a few DEBUGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Implement streams_depot_fstatat()
Volker Lendecke [Thu, 2 Jan 2025 11:28:55 +0000 (12:28 +0100)] 
vfs: Implement streams_depot_fstatat()

So far we don't call FSTATAT on streams, but this might change soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Implement streams_xattr_fstatat()
Volker Lendecke [Thu, 2 Jan 2025 13:31:55 +0000 (14:31 +0100)] 
vfs: Implement streams_xattr_fstatat()

So far we don't call FSTATAT on streams, but this might change soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Fix streams_depot_lstat()
Volker Lendecke [Thu, 2 Jan 2025 08:37:32 +0000 (09:37 +0100)] 
vfs: Fix streams_depot_lstat()

When passing NULL as base_sbuf to stream_smb_fname(), it uses
SMB_VFS_NEXT_STAT() to find the right stream directory. This will
potentially dereference the last symlink. Make sure that in
streams_depot_lstat() this is not done.

Also, the current version did not return the stat struct at all.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Use filename_convert_dirfsp_rel() in durable reconnect
Volker Lendecke [Wed, 1 Jan 2025 14:51:11 +0000 (15:51 +0100)] 
smbd: Use filename_convert_dirfsp_rel() in durable reconnect

Avoid a reference to conn->cwd_fsp and thus simplify the code used in
fd_openat().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agostreams_depot: Simplify walk_streams()
Volker Lendecke [Sat, 18 Jan 2025 14:11:42 +0000 (15:11 +0100)] 
streams_depot: Simplify walk_streams()

Remove unused pdirname parameter

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Simplify delete_all_streams()
Volker Lendecke [Thu, 2 Jan 2025 17:14:43 +0000 (18:14 +0100)] 
smbd: Simplify delete_all_streams()

In our callers we have the dirfsp around, use that and avoid
references to conn->cwd_fsp and deep path-based operations

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Move parent_pathref() up in close_remove_share_mode()
Volker Lendecke [Thu, 2 Jan 2025 21:03:59 +0000 (22:03 +0100)] 
smbd: Move parent_pathref() up in close_remove_share_mode()

Make it available for delete_all_streams()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Move parent_pathref() out of rmdir_internals()
Volker Lendecke [Thu, 2 Jan 2025 17:01:47 +0000 (18:01 +0100)] 
smbd: Move parent_pathref() out of rmdir_internals()

Make the dirfsp() available in close_directory()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Simplify rmdir_internals()
Volker Lendecke [Fri, 3 Jan 2025 09:47:13 +0000 (10:47 +0100)] 
smbd: Simplify rmdir_internals()

recursive_rmdir_fsp() works fine on the original fsp passed in, we
don't need to fetch the dirfsp from the dir_hnd we created to call
can_delete_directory_hnd()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs_fruit: Don't expect a pathref fsp in unlinkat
Volker Lendecke [Fri, 3 Jan 2025 11:33:43 +0000 (12:33 +0100)] 
vfs_fruit: Don't expect a pathref fsp in unlinkat

The unix syscall unlinkat does not expect a file descriptor for the
to-be-removed object. SMB_VFS_UNLINKAT should also not expect
that. Put the special case into vfs_fruit.

This is required to simplify delete_all_streams next, which should not
have to do an openat_pathref_fsp() on all streams just for the
vfs_fruit case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Modernize a DEBUG
Volker Lendecke [Mon, 20 Jan 2025 14:54:53 +0000 (15:54 +0100)] 
smbd: Modernize a DEBUG

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Do an early talloc_free in an error path
Volker Lendecke [Mon, 20 Jan 2025 14:52:06 +0000 (15:52 +0100)] 
vfs: Do an early talloc_free in an error path

Not a long-term memleak, talloc_tos() takes care of this later, but
this looks cleaner to me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Rename variables in streams_depot_renameat()
Volker Lendecke [Fri, 17 Jan 2025 12:24:11 +0000 (13:24 +0100)] 
vfs: Rename variables in streams_depot_renameat()

These are directory fsps

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Use is_ntfs_stream_smb_fname() where appropriate
Volker Lendecke [Mon, 30 Dec 2024 19:16:41 +0000 (20:16 +0100)] 
vfs: Use is_ntfs_stream_smb_fname() where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Slightly simplify acl_common_remove_object()
Volker Lendecke [Mon, 30 Dec 2024 19:15:53 +0000 (20:15 +0100)] 
vfs: Slightly simplify acl_common_remove_object()

This makes it more obvious to me that it's just the flag that differs
between the if-branches.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Simplify acl_common_remove_object()
Volker Lendecke [Mon, 30 Dec 2024 19:28:39 +0000 (20:28 +0100)] 
vfs: Simplify acl_common_remove_object()

These days we have "dirfsp" available inside the unlinkat vfs
functions. There's no need to mess with the cwd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agodsdb: Avoid a talloc
Volker Lendecke [Mon, 13 Jan 2025 09:07:46 +0000 (10:07 +0100)] 
dsdb: Avoid a talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Slightly simplify rename_internals_fsp()
Volker Lendecke [Mon, 13 Jan 2025 12:38:46 +0000 (13:38 +0100)] 
smbd: Slightly simplify rename_internals_fsp()

The required permissions only depend on S_ISDIR, but before this patch
they were assigned in two places far away from the call to
check_parent_access_fsp(). Consolidate that into where the permissions
are checked.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Slightly simplify rename_internals_fsp()
Volker Lendecke [Mon, 13 Jan 2025 12:32:29 +0000 (13:32 +0100)] 
smbd: Slightly simplify rename_internals_fsp()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agopam_winbind: Align integer types
Volker Lendecke [Wed, 18 Dec 2024 15:49:10 +0000 (16:49 +0100)] 
pam_winbind: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agonsswitch: Align integer types
Volker Lendecke [Mon, 23 Dec 2024 10:14:00 +0000 (11:14 +0100)] 
nsswitch: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agonsswitch: Simplify wbcCtxDcInfo()
Volker Lendecke [Mon, 23 Dec 2024 10:08:35 +0000 (11:08 +0100)] 
nsswitch: Simplify wbcCtxDcInfo()

Use winbindd_free_response()

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agodsdb: Align an integer type
Volker Lendecke [Sun, 29 Dec 2024 10:57:00 +0000 (11:57 +0100)] 
dsdb: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agodsdb: Simplification with generate_random_str_list_buf()
Volker Lendecke [Sun, 29 Dec 2024 10:54:38 +0000 (11:54 +0100)] 
dsdb: Simplification with generate_random_str_list_buf()

No NULL check required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agotorture4: Simplification with generate_random_str_list_buf()
Volker Lendecke [Sun, 29 Dec 2024 10:49:35 +0000 (11:49 +0100)] 
torture4: Simplification with generate_random_str_list_buf()

No NULL check required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agotorture4: Align a few integer types
Volker Lendecke [Sat, 28 Dec 2024 11:08:21 +0000 (12:08 +0100)] 
torture4: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agotorture4: Use generate_random_str_list_buf()
Volker Lendecke [Sat, 28 Dec 2024 10:59:52 +0000 (11:59 +0100)] 
torture4: Use generate_random_str_list_buf()

Avoid a theoretical printf("%s", NULL)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmb1_srv: Use generate_random_str_list_buf()
Volker Lendecke [Fri, 27 Dec 2024 17:53:27 +0000 (18:53 +0100)] 
smb1_srv: Use generate_random_str_list_buf()

Avoid a theoretical printf("%s", NULL)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolib: factor out generate_random_str_list_buf()
Volker Lendecke [Fri, 27 Dec 2024 17:43:57 +0000 (18:43 +0100)] 
lib: factor out generate_random_str_list_buf()

No talloc required

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolibsmb: Remove a pointless if-statement
Volker Lendecke [Mon, 30 Dec 2024 11:55:15 +0000 (12:55 +0100)] 
libsmb: Remove a pointless if-statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Use fsp_is_alternate_stream() in shadow_copy2
Volker Lendecke [Sat, 11 Jan 2025 08:54:12 +0000 (09:54 +0100)] 
vfs: Use fsp_is_alternate_stream() in shadow_copy2

To me this makes the meaning of this if-statement more obvious

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Modernize a DEBUG
Volker Lendecke [Thu, 2 Jan 2025 16:32:45 +0000 (17:32 +0100)] 
smbd: Modernize a DEBUG

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agodocs: Fix a copy&paste error
Volker Lendecke [Mon, 13 Jan 2025 17:26:37 +0000 (18:26 +0100)] 
docs: Fix a copy&paste error

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Fix a typo
Volker Lendecke [Mon, 13 Jan 2025 15:45:03 +0000 (16:45 +0100)] 
vfs: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Fix DBGs
Volker Lendecke [Mon, 13 Jan 2025 14:50:02 +0000 (15:50 +0100)] 
vfs: Fix DBGs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agotorture3: Fix an error message
Volker Lendecke [Mon, 19 Dec 2022 15:35:51 +0000 (16:35 +0100)] 
torture3: Fix an error message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Use MIN() instead of explicit if-statement
Volker Lendecke [Fri, 16 Dec 2022 13:12:57 +0000 (14:12 +0100)] 
smbd: Use MIN() instead of explicit if-statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosamba-tool user disable: add new --remove-supplemental-groups option
Björn Baumbach [Wed, 20 Nov 2024 16:54:17 +0000 (17:54 +0100)] 
samba-tool user disable: add new --remove-supplemental-groups option

Removes all supplemental groups from a user, what is commonly
wanted when a user is disabled.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Thu Jan 23 19:51:05 UTC 2025 on atb-devel-224

6 months agosamba-tool user disable: make sure that filter matches only one user
Björn Baumbach [Wed, 20 Nov 2024 16:24:10 +0000 (17:24 +0100)] 
samba-tool user disable: make sure that filter matches only one user

toggle_userAccountFlags() can only handle one user.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agosamba-tool user disable: rename filter variable to search_filter
Björn Baumbach [Wed, 20 Nov 2024 16:10:12 +0000 (17:10 +0100)] 
samba-tool user disable: rename filter variable to search_filter

filter() is a Python built-in function to filter iterables.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agosamba-tool user disable: set proper --filter option description
Björn Baumbach [Wed, 20 Nov 2024 16:03:24 +0000 (17:03 +0100)] 
samba-tool user disable: set proper --filter option description

Seems to be copied from samba-tool user setpassword command.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agosamba-tool group removemembers: avoid python backtrace on error
Björn Baumbach [Tue, 26 Nov 2024 16:47:30 +0000 (17:47 +0100)] 
samba-tool group removemembers: avoid python backtrace on error

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agopython/samdb: no need to set member_base_dn multiple times
Björn Baumbach [Fri, 22 Nov 2024 21:35:29 +0000 (22:35 +0100)] 
python/samdb: no need to set member_base_dn multiple times

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agopython/samdb: fix group member removal by SID
Björn Baumbach [Tue, 26 Nov 2024 14:46:02 +0000 (15:46 +0100)] 
python/samdb: fix group member removal by SID

Otherwise the removal of groupmembers by SID fails silently, because the
DN does not match the the DN in group member list.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agopython/samdb: fix check which checks if user is already member of group
Björn Baumbach [Mon, 25 Nov 2024 13:05:40 +0000 (14:05 +0100)] 
python/samdb: fix check which checks if user is already member of group

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agopython/samdb: rename filter variable to search_filter
Björn Baumbach [Wed, 20 Nov 2024 22:28:51 +0000 (23:28 +0100)] 
python/samdb: rename filter variable to search_filter

filter() is a Python built-in function to filter iterables.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agopython/samdb: add missing function parameter description
Björn Baumbach [Wed, 20 Nov 2024 20:33:49 +0000 (21:33 +0100)] 
python/samdb: add missing function parameter description

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agopython/samdb: fix attribute name in parameter description
Björn Baumbach [Wed, 18 Sep 2024 17:22:29 +0000 (19:22 +0200)] 
python/samdb: fix attribute name in parameter description

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
6 months agothird_party: Update socket_wrapper to version 1.4.4
Andreas Schneider [Wed, 22 Jan 2025 14:37:07 +0000 (15:37 +0100)] 
third_party: Update socket_wrapper to version 1.4.4

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 23 11:28:32 UTC 2025 on atb-devel-224

6 months agolib:replace: Don't use deprecated readline CPPFunction cast
Andreas Schneider [Tue, 21 Jan 2025 16:59:27 +0000 (17:59 +0100)] 
lib:replace: Don't use deprecated readline CPPFunction cast

HAVE_RL_COMPLETION_FUNC_T was unused and not checking for the right
function.

libcli/smbreadline/smbreadline.c: In function ‘smb_readline’:
libcli/smbreadline/smbreadline.c:139:17: warning: ‘CPPFunction’ is deprecated [-Wdeprecated-declarations]
  139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libcli/smbreadline/smbreadline.c:139:50: error: assignment to ‘char ** (*)(const char *, int,  int)’ from incompatible pointer type ‘char ** (*)(void)’ [-Wincompatible-pointer-types]
  139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
      |                                                  ^

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jan 21 19:38:37 UTC 2025 on atb-devel-224

6 months agolib:replace: Remove trailing spaces from readline.h
Andreas Schneider [Tue, 21 Jan 2025 16:59:12 +0000 (17:59 +0100)] 
lib:replace: Remove trailing spaces from readline.h

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
6 months agovfs_fruit: Fix 63f0b59cbed
Volker Lendecke [Sun, 19 Jan 2025 16:27:56 +0000 (17:27 +0100)] 
vfs_fruit: Fix 63f0b59cbed

After 30 years of coding C, pointers and macros are still error-prone :-(

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Jan 20 08:00:24 UTC 2025 on atb-devel-224

6 months agolib:util: Fix stack-use-after-return in crypt_as_best_we_can()
Andreas Schneider [Fri, 17 Jan 2025 12:28:30 +0000 (13:28 +0100)] 
lib:util: Fix stack-use-after-return in crypt_as_best_we_can()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Jan 17 23:21:13 UTC 2025 on atb-devel-224

6 months agovfs_ceph_new: add smbprofile for async-ops
Shachar Sharon [Tue, 14 Jan 2025 09:46:05 +0000 (11:46 +0200)] 
vfs_ceph_new: add smbprofile for async-ops

Commit fcd3fc34b2ec5e ("vfs_ceph_new: add profiling support") added
PROFILE accounting for non-async VFS hooks. Add also SMBPROFILE for
async (read/write/fsync) hooks.

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): Fri Jan 17 16:47:28 UTC 2025 on atb-devel-224

6 months agoauth: Cleanup exit code paths in kerberos_decode_pac().
Jeremy Allison [Fri, 17 Jan 2025 00:12:31 +0000 (16:12 -0800)] 
auth: Cleanup exit code paths in kerberos_decode_pac().

One more memory leak missed and now fixed. tmp_ctx
must be freed once the pac data is talloc_move'd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Jan 17 12:01:47 UTC 2025 on atb-devel-224

6 months agoauth: Add missing talloc_free() in error code path.
Jeremy Allison [Wed, 15 Jan 2025 18:21:19 +0000 (10:21 -0800)] 
auth: Add missing talloc_free() in error code path.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Jan 16 14:32:39 UTC 2025 on atb-devel-224

6 months agos3:winbindd: split our wb_gettoken_trybuiltins() helper
Stefan Metzmacher [Sat, 23 Jul 2022 22:46:06 +0000 (00:46 +0200)] 
s3:winbindd: split our wb_gettoken_trybuiltins() helper

This makes the logical steps a bit cleaner and future changes easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jan 15 14:00:28 UTC 2025 on atb-devel-224

6 months agos3:winbindd: split out wb_gettoken_trylocalgroups() function
Stefan Metzmacher [Sat, 23 Jul 2022 22:44:07 +0000 (00:44 +0200)] 
s3:winbindd: split out wb_gettoken_trylocalgroups() function

This makes the logical steps a bit cleaner and future changes easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 months agos3:winbindd: add winbindd_domain_verify_sid() helper
Stefan Metzmacher [Fri, 22 Jul 2022 13:15:56 +0000 (15:15 +0200)] 
s3:winbindd: add winbindd_domain_verify_sid() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>