]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 years agoCVE-2023-4154 dsdb/tests: Add test for SEARCH_FLAG_RODC_ATTRIBUTE behaviour
Andrew Bartlett [Tue, 8 Aug 2023 02:30:19 +0000 (14:30 +1200)] 
CVE-2023-4154 dsdb/tests: Add test for SEARCH_FLAG_RODC_ATTRIBUTE behaviour

SEARCH_FLAG_RODC_ATTRIBUTE should be like SEARCH_FLAG_CONFIDENTIAL,
but for DirSync and DRS replication.  Accounts with
GUID_DRS_GET_CHANGES rights should not be able to read this
attribute.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agoCVE-2023-4154 dsdb/tests: Speed up DirSync test by only checking positive matches...
Andrew Bartlett [Mon, 7 Aug 2023 23:18:46 +0000 (11:18 +1200)] 
CVE-2023-4154 dsdb/tests: Speed up DirSync test by only checking positive matches once

When we (expect to) get back a result, do not waste time against a potentially
slow server confirming we also get back results for all the other attribute
combinations.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agoCVE-2023-4154 dsdb/tests: Check that secret attributes are not visible with DirSync...
Andrew Bartlett [Sun, 6 Aug 2023 23:56:56 +0000 (11:56 +1200)] 
CVE-2023-4154 dsdb/tests: Check that secret attributes are not visible with DirSync ever.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agoCVE-2023-4154 dsdb/tests: Force the test attribute to be not-confidential at the...
Andrew Bartlett [Mon, 7 Aug 2023 02:44:28 +0000 (14:44 +1200)] 
CVE-2023-4154 dsdb/tests: Force the test attribute to be not-confidential at the start

Rather than fail, if the last run failed to reset things, just force
the DC into the required state.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agoCVE-2023-4154 dsdb/tests: Use self.addCleanup() and delete_force()
Andrew Bartlett [Mon, 7 Aug 2023 01:15:40 +0000 (13:15 +1200)] 
CVE-2023-4154 dsdb/tests: Use self.addCleanup() and delete_force()

Thie helps ensure this test is reliable even in spite of errors while
running.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agoCVE-2023-4154 dsdb/tests: Do not run SimpleDirsyncTests twice
Andrew Bartlett [Sun, 6 Aug 2023 23:55:55 +0000 (11:55 +1200)] 
CVE-2023-4154 dsdb/tests: Do not run SimpleDirsyncTests twice

To re-use setup code, the super-class must have no test_*() methods
otherwise these will be run as well as the class-local tests.

We rename tests that would otherwise have duplicate names

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2 years agoCVE-2023-4091: smbd: use open_access_mask for access check in open_file()
Ralph Boehme [Tue, 1 Aug 2023 11:04:36 +0000 (13:04 +0200)] 
CVE-2023-4091: smbd: use open_access_mask for access check in open_file()

If the client requested FILE_OVERWRITE[_IF], we're implicitly adding
FILE_WRITE_DATA to the open_access_mask in open_file_ntcreate(), but for the
access check we're using access_mask which doesn't contain the additional
right, which means we can end up truncating a file for which the user has
only read-only access via an SD.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
2 years agoCVE-2023-4091: smbtorture: test overwrite dispositions on read-only file
Ralph Boehme [Tue, 1 Aug 2023 10:30:00 +0000 (12:30 +0200)] 
CVE-2023-4091: smbtorture: test overwrite dispositions on read-only file

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

Signed-off-by: Ralph Boehme <slow@samba.org>
2 years agoCVE-2023-3961:s3: smbd: Remove the SMB_ASSERT() that crashes on bad pipenames.
Jeremy Allison [Wed, 26 Jul 2023 00:54:41 +0000 (17:54 -0700)] 
CVE-2023-3961:s3: smbd: Remove the SMB_ASSERT() that crashes on bad pipenames.

We correctly handle this and just return ENOENT (NT_STATUS_OBJECT_NAME_NOT_FOUND).

Remove knowfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
2 years agoCVE-2023-3961:s3:torture: Add test SMB2-INVALID-PIPENAME to show we allow bad pipenam...
Jeremy Allison [Wed, 26 Jul 2023 00:49:21 +0000 (17:49 -0700)] 
CVE-2023-3961:s3:torture: Add test SMB2-INVALID-PIPENAME to show we allow bad pipenames with unix separators through to the UNIX domain socket code.

The raw SMB2-INVALID-PIPENAME test passes against Windows 2022,
as it just returns NT_STATUS_OBJECT_NAME_NOT_FOUND.

Add the knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
2 years agoCVE-2023-3961:s3:smbd: Catch any incoming pipe path that could exit socket_dir.
Jeremy Allison [Wed, 26 Jul 2023 00:41:04 +0000 (17:41 -0700)] 
CVE-2023-3961:s3:smbd: Catch any incoming pipe path that could exit socket_dir.

For now, SMB_ASSERT() to exit the server. We will remove
this once the test code is in place.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
2 years agoctdb: Add "home_nodes" file to deterministic IP allocation
Volker Lendecke [Fri, 4 Aug 2023 12:47:51 +0000 (14:47 +0200)] 
ctdb: Add "home_nodes" file to deterministic IP allocation

With a file "home_nodes" next to "public_addresses" you can assign
public IPs to specific nodes when using the deterministic allocation
algorithm. Whenever the "home node" is up, the IP address will be
assigned to that node, independent of any other deterministic
calculation. The line

192.168.21.254 2

in the file "home_nodes" assigns the IP address to node 2. Only when
node 2 is not able to host IP addresses, 192.168.21.254 undergoes the
normal deterministic IP allocation algorithm.

Signed-off-by: Volker Lendecke <vl@samba.org>
add home_nodes
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Oct 10 14:17:19 UTC 2023 on atb-devel-224

2 years agoctdb: setup $CTDB_BASE for deterministic ip alloc tests
Volker Lendecke [Thu, 5 Oct 2023 15:11:51 +0000 (17:11 +0200)] 
ctdb: setup $CTDB_BASE for deterministic ip alloc tests

ipalloc_deterministic() will require it in the next patch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdb: Align variable signedness
Volker Lendecke [Fri, 4 Aug 2023 13:35:46 +0000 (15:35 +0200)] 
ctdb: Align variable signedness

ipalloc_state->num_nodes is uint32_t
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdb: Reduce indentation in get_tunable_values()
Volker Lendecke [Thu, 28 Sep 2023 13:55:36 +0000 (15:55 +0200)] 
ctdb: Reduce indentation in get_tunable_values()

Use an early return tvals; review with "git sh -b".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agoctdb: Fix whitespace
Volker Lendecke [Thu, 28 Sep 2023 13:50:28 +0000 (15:50 +0200)] 
ctdb: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agos3: smbd: Ignore fstat() error on deleted stream in fd_close().
Ralph Boehme [Wed, 20 Sep 2023 21:21:44 +0000 (14:21 -0700)] 
s3: smbd: Ignore fstat() error on deleted stream in fd_close().

In the fd_close() fsp->fsp_flags.fstat_before_close code path.

If this is a stream and delete-on-close was set, the
backing object (an xattr from streams_xattr) might
already be deleted so fstat() fails with
NT_STATUS_NOT_FOUND. So if fsp refers to a stream we
ignore the error and only bail for normal files where
an fstat() should still work. NB. We cannot use
fsp_is_alternate_stream(fsp) for this as the base_fsp
has already been closed at this point and so the value
fsp_is_alternate_stream() checks for is already NULL.

Remove knownfail.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Oct 10 09:39:27 UTC 2023 on atb-devel-224

2 years agotests: Add reproducer for bug 15487
Volker Lendecke [Sat, 7 Oct 2023 10:28:05 +0000 (12:28 +0200)] 
tests: Add reproducer for bug 15487

Show that smbd crashes if asked to return full information on close of a
stream handle with delete on close disposition set.

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agopylibsmb: Add SMB2_CLOSE_FLAGS_FULL_INFORMATION constant
Volker Lendecke [Sat, 7 Oct 2023 10:20:35 +0000 (12:20 +0200)] 
pylibsmb: Add SMB2_CLOSE_FLAGS_FULL_INFORMATION constant

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Pass "flags" through cli_close_send() and pylibsmb
Volker Lendecke [Sat, 7 Oct 2023 10:13:09 +0000 (12:13 +0200)] 
libsmb: Pass "flags" through cli_close_send() and pylibsmb

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Add "flags" to cli_smb2_close_fnum_send()
Volker Lendecke [Sat, 7 Oct 2023 10:06:26 +0000 (12:06 +0200)] 
libsmb: Add "flags" to cli_smb2_close_fnum_send()

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agovfs: Add VFS_OPEN_HOW_WITH_BACKUP_INTENT
Volker Lendecke [Fri, 1 Sep 2023 12:51:47 +0000 (14:51 +0200)] 
vfs: Add VFS_OPEN_HOW_WITH_BACKUP_INTENT

Indicate BACKUP_INTENT to vfs_openat(). Why? I have a customer request
who wants to add O_NOATIME in this case to avoid metadata updates when
a backup or virus-checking application comes along.

This does not fully handle BACKUP_INTENT correctly, this would require
become_root() appropriately. We might want to do that later after a
lot of careful security audit, but this patch independently might
already provide some infrastructure for it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Oct  5 14:00:33 UTC 2023 on atb-devel-224

2 years agosmbd: Remove "flags2" from open_file_ntcreate()
Volker Lendecke [Tue, 5 Sep 2023 13:55:26 +0000 (15:55 +0200)] 
smbd: Remove "flags2" from open_file_ntcreate()

"flags" carried just the O_ACCMODE bits, "flags2" everything
else. Unify them.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Pass struct vfs_open_how to open_file()
Volker Lendecke [Tue, 5 Sep 2023 13:36:01 +0000 (15:36 +0200)] 
smbd: Pass struct vfs_open_how to open_file()

We want to pass BACKUP_INTENT down into reopen_from_fsp, and the
elegant way is to do this via vfs_open_how.resolve.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Remove "local_flags" from open_file()
Volker Lendecke [Tue, 5 Sep 2023 13:27:46 +0000 (15:27 +0200)] 
smbd: Remove "local_flags" from open_file()

This needs close review. I could not see where we were actually
referencing the original flags in a way that would not be available in
local_flags. The reason for this patch is that I want to pass in
vfs_open_how into open_file(), and the distinction between flags and
local_flags made this significantly harder to understand for me.

The only place where we really used both versions is the DBG_NOTICE in
the last hunk, and this will come back in the next patch.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Make open_file() a bit safer
Volker Lendecke [Tue, 5 Sep 2023 13:25:07 +0000 (15:25 +0200)] 
smbd: Make open_file() a bit safer

Move adding O_RDWR before the check for read only shares. I haven't
been able to pass this condition through SMB, but in any case we
should not accidentially open with O_RDWR in the !CAN_WRITE(conn)
case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Simplify open_file()
Volker Lendecke [Tue, 5 Sep 2023 12:59:29 +0000 (14:59 +0200)] 
smbd: Simplify open_file()

Simplify an if-condition:

We have to return NT_STATUS_OBJECT_NAME_INVALID even if we're not
creating. In fact, we probably should not end up in open_file() if
we're open a Windows file with a wildcard.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Simplify open_file()
Volker Lendecke [Fri, 1 Sep 2023 14:33:04 +0000 (16:33 +0200)] 
smbd: Simplify open_file()

We have extracted FSP_POSIX_FLAGS_PATHNAMES above.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Simplify open_file()
Volker Lendecke [Tue, 5 Sep 2023 12:53:18 +0000 (14:53 +0200)] 
smbd: Simplify open_file()

We handle O_TRUNC further down anyway by passing local_flags&~O_TRUNC to
reopen_from_fsp(). No need for this FIFO special case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Simplify an if-condition in open_file()
Volker Lendecke [Tue, 5 Sep 2023 12:50:05 +0000 (14:50 +0200)] 
smbd: Simplify an if-condition in open_file()

We use the plain (flags&O_TRUNC) a few lines above, make the
if-condition a bit more readable.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Simplify open_file()
Volker Lendecke [Tue, 5 Sep 2023 12:46:21 +0000 (14:46 +0200)] 
smbd: Simplify open_file()

We can unconditionally just and-out O_CREAT from local_flags, so
remove an if-condition.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Don't change incoming flags in open_file()
Volker Lendecke [Tue, 5 Sep 2023 12:44:37 +0000 (14:44 +0200)] 
smbd: Don't change incoming flags in open_file()

This will be part of a const struct vfs_open_how soon. Further down in
this function we don't look at O_CREAT or O_EXCL of "flags" anymore
anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Remove variable "accmode" from open_file()
Volker Lendecke [Tue, 5 Sep 2023 12:40:30 +0000 (14:40 +0200)] 
smbd: Remove variable "accmode" from open_file()

We directly look at the flags in many other places in this function,
so do this also for O_ACCMODE for clarity.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Slightly simplify open_file()
Volker Lendecke [Fri, 1 Sep 2023 14:31:03 +0000 (16:31 +0200)] 
smbd: Slightly simplify open_file()

Replace "truncating" variable reference with what it was defined
as. We use "(flags & O_TRUNC)" a few lines above, so it can't be that
bad.

After we set it to "false" further down, it was never used again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Pass "struct vfs_open_how" to reopen_from_fsp()
Volker Lendecke [Thu, 31 Aug 2023 14:26:57 +0000 (16:26 +0200)] 
smbd: Pass "struct vfs_open_how" to reopen_from_fsp()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Pass "struct vfs_open_how" to fd_open_atomic()
Volker Lendecke [Thu, 31 Aug 2023 13:04:18 +0000 (15:04 +0200)] 
smbd: Pass "struct vfs_open_how" to fd_open_atomic()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agosmbd: Pass "struct vfs_open_how" to reopen_from_procfd()
Volker Lendecke [Thu, 31 Aug 2023 12:59:47 +0000 (14:59 +0200)] 
smbd: Pass "struct vfs_open_how" to reopen_from_procfd()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2 years agolibsmb: Use pidl generated parsing for posix file info
Volker Lendecke [Wed, 4 Oct 2023 14:33:01 +0000 (16:33 +0200)] 
libsmb: Use pidl generated parsing for posix file info

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): Wed Oct  4 21:26:20 UTC 2023 on atb-devel-224

2 years agolibsmb: Pass NTTIME to interpret_long_date()
Volker Lendecke [Wed, 4 Oct 2023 11:25:21 +0000 (13:25 +0200)] 
libsmb: Pass NTTIME to interpret_long_date()

Separate concerns of conversion and pulling off the wire. Needed soon
for smb311 pidl generated parsing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibndr: Factor out ndr_pull_struct_blob_noalloc()
Volker Lendecke [Tue, 3 Oct 2023 09:39:36 +0000 (11:39 +0200)] 
libndr: Factor out ndr_pull_struct_blob_noalloc()

smb3_file_posix_information is variable length with something behind.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Remove unused marshalling of smb3posix file information
Volker Lendecke [Wed, 27 Sep 2023 08:54:26 +0000 (10:54 +0200)] 
smbd: Remove unused marshalling of smb3posix file information

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use Use smb3posix marshalling in in smbd_do_qfilepathinfo()
Volker Lendecke [Wed, 27 Sep 2023 08:51:37 +0000 (10:51 +0200)] 
smbd: Use Use smb3posix marshalling in in smbd_do_qfilepathinfo()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use Use smb3posix marshalling in in smbd_marshall_dir_entry()
Volker Lendecke [Wed, 27 Sep 2023 08:48:35 +0000 (10:48 +0200)] 
smbd: Use Use smb3posix marshalling in in smbd_marshall_dir_entry()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Modernize a DEBUG statement
Volker Lendecke [Wed, 27 Sep 2023 15:43:33 +0000 (17:43 +0200)] 
smbd: Modernize a DEBUG statement

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Add smb3_file_posix_information_init()
Volker Lendecke [Wed, 27 Sep 2023 08:44:30 +0000 (10:44 +0200)] 
smbd: Add smb3_file_posix_information_init()

Copy the logic from store_smb2_posix_info() to allow use of
ndr_push_smb3_file_posix_information().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbd: Use smb3posix marshalling in smbd_smb2_create_after_exec()
Volker Lendecke [Wed, 27 Sep 2023 07:22:53 +0000 (09:22 +0200)] 
smbd: Use smb3posix marshalling in smbd_smb2_create_after_exec()

Signed-off-by: Volker Lendecke <vl@samba.org>
2 years agoidl: Add smb3posix.idl
Volker Lendecke [Wed, 27 Sep 2023 04:44:41 +0000 (06:44 +0200)] 
idl: Add smb3posix.idl

Let PIDL take care of encoding SMB2_FILE_POSIX_INFORMATION. This way
we also get parsing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Allow NULL print_name in reparse_data_buffer_marshall()
Volker Lendecke [Tue, 26 Sep 2023 12:54:37 +0000 (14:54 +0200)] 
libsmb: Allow NULL print_name in reparse_data_buffer_marshall()

read_symlink_reparse() does this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agopylibsmb: Py_BuildValue can build tuples directly
Volker Lendecke [Tue, 26 Sep 2023 12:16:08 +0000 (14:16 +0200)] 
pylibsmb: Py_BuildValue can build tuples directly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotests: Run smb3unix tests with SMB1
Volker Lendecke [Tue, 26 Sep 2023 10:01:17 +0000 (12:01 +0200)] 
tests: Run smb3unix tests with SMB1

We want to create native FIFOs with smb1 extensions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotests: We always do smb3 unix extensions
Volker Lendecke [Tue, 26 Sep 2023 09:57:47 +0000 (11:57 +0200)] 
tests: We always do smb3 unix extensions

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoctdb-scripts: Convert 40.vsftpd to use threshold-based fail counting
Martin Schwenke [Mon, 24 Jul 2023 23:52:56 +0000 (09:52 +1000)] 
ctdb-scripts: Convert 40.vsftpd to use threshold-based fail counting

This effectively provides simple testing for the threshold-based
approach.

Add new script option CTDB_VSFTPD_MONITOR_THRESHOLDS.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Oct  3 04:53:38 UTC 2023 on atb-devel-224

2 years agoctdb-scripts: Implement failcount handling with thresholds
Martin Schwenke [Fri, 3 Mar 2023 06:49:05 +0000 (17:49 +1100)] 
ctdb-scripts: Implement failcount handling with thresholds

This can be used for simple failure counting, without restarts, as
used in the 40.vsftpd event script.  That case will subsequently be
converted and this functionality can also be used elsewhere.

Add documentation to ctdb-script.options(5) to allow parameters that
use this to be more easily described.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-scripts: Avoid errors for uninitialised counters
Martin Schwenke [Wed, 15 Mar 2023 06:56:40 +0000 (17:56 +1100)] 
ctdb-scripts: Avoid errors for uninitialised counters

Uninitialised counters are treated as 0, but still produce an error.

The redirect to stderr needs to come before the redirect for a missing
counter file.

The seemingly saner alternative of moving it outside the subshell
works when dash is /bin/sh (e.g. on Debian) but does not work when
bash is /bin/sh (e.g. on Fedora).

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-doc: Add some subsection names in description
Martin Schwenke [Tue, 25 Jul 2023 02:19:07 +0000 (12:19 +1000)] 
ctdb-doc: Add some subsection names in description

A subsequent commit will add a new section, which looks out of place
without these new sections.

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agoctdb-doc: Update CTDB manual pages to UTF-8
Martin Schwenke [Tue, 25 Jul 2023 01:42:32 +0000 (11:42 +1000)] 
ctdb-doc: Update CTDB manual pages to UTF-8

This will allow Unicode characters to be used, resulting in more
readable source files.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2 years agotests/krb5: Test that the correct Asserted Identity SID is added when inner FX‐FAST...
Joseph Sutton [Wed, 27 Sep 2023 23:47:49 +0000 (12:47 +1300)] 
tests/krb5: Test that the correct Asserted Identity SID is added when inner FX‐FAST padata is used

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Joseph Sutton <jsutton@samba.org>
Autobuild-Date(master): Sun Oct  1 23:46:44 UTC 2023 on atb-devel-224

2 years agos4:kdc: Make use of ‘samba_kdc_entry_pac’ wrapper type
Joseph Sutton [Wed, 27 Sep 2023 22:43:57 +0000 (11:43 +1300)] 
s4:kdc: Make use of ‘samba_kdc_entry_pac’ wrapper type

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add function to get device PAC entry from Heimdal request structure
Joseph Sutton [Fri, 29 Sep 2023 00:53:24 +0000 (13:53 +1300)] 
s4:kdc: Add function to get device PAC entry from Heimdal request structure

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add function to determine whether a KDC entry represents a trust
Joseph Sutton [Fri, 29 Sep 2023 07:11:52 +0000 (20:11 +1300)] 
s4:kdc: Add function to determine whether a KDC entry represents a trust

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Fix indentation
Joseph Sutton [Fri, 29 Sep 2023 02:42:52 +0000 (15:42 +1300)] 
s4:kdc: Fix indentation

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove unused declaration
Joseph Sutton [Thu, 28 Sep 2023 23:08:54 +0000 (12:08 +1300)] 
s4:kdc: Remove unused declaration

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add ‘samba_kdc_entry_pac’ wrapper type
Joseph Sutton [Wed, 27 Sep 2023 00:15:15 +0000 (13:15 +1300)] 
s4:kdc: Add ‘samba_kdc_entry_pac’ wrapper type

With embedded Heimdal, we can mark a PAC as being trusted (i.e. not
issued by an RODC). This is convenient, as it saves us needing to carry
that information in flags, hoping it isn’t inadvertently lost.

System Heimdal and MIT Kerberos, however, don’t provide a way to mark a
PAC trusted. So we add a new wrapper type, ‘samba_kdc_entry_pac’, that
contains this extra information if ‘krb5_const_pac’ doesn’t contain it
already. As it also stores a pointer to the client entry, the
structure’s lifetime must therefore be carefully managed. Finally, it
keeps track of whether the PAC came across a trust, to know which is
useful in some circumstances.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agothird_party/heimdal_build: Define HAVE_KRB5_PAC_IS_TRUSTED when using embedded Heimdal
Joseph Sutton [Wed, 27 Sep 2023 00:14:09 +0000 (13:14 +1300)] 
third_party/heimdal_build: Define HAVE_KRB5_PAC_IS_TRUSTED when using embedded Heimdal

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Add Device Restriction tests for silos and authentication policies in...
Joseph Sutton [Tue, 2 May 2023 03:42:24 +0000 (15:42 +1200)] 
tests/krb5: Add Device Restriction tests for silos and authentication policies in the KDC

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove unused parameters from samba_kdc_verify_pac()
Joseph Sutton [Fri, 29 Sep 2023 00:50:51 +0000 (13:50 +1300)] 
s4:kdc: Remove unused parameters from samba_kdc_verify_pac()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove device PAC validation
Joseph Sutton [Thu, 28 Sep 2023 23:44:08 +0000 (12:44 +1300)] 
s4:kdc: Remove device PAC validation

In the first place, this check was only applicable to the Heimdal KDC,
the MIT KDC not having support for compounded authentication. Secondly,
it was redundant, because _kdc_fast_check_armor_pac() would have already
been called to verify the armor ticket; a second round of validation
achieved nothing. And finally, the check was flawed: it checked only
*explicitly* armored PACs, and so would have done nothing for an armored
*AS‐REQ*.

In short, this check was useless; remove it.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Add tests performing AS‐REQs armored with unacceptable tickets
Joseph Sutton [Fri, 29 Sep 2023 00:21:01 +0000 (13:21 +1300)] 
tests/krb5: Add tests performing AS‐REQs armored with unacceptable tickets

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Add method to perform an armored AS‐REQ
Joseph Sutton [Fri, 29 Sep 2023 00:13:01 +0000 (13:13 +1300)] 
tests/krb5: Add method to perform an armored AS‐REQ

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/krb5: Initialize variable
Joseph Sutton [Fri, 29 Sep 2023 00:27:39 +0000 (13:27 +1300)] 
tests/krb5: Initialize variable

This avoids the following exception:

Exception: Traceback (most recent call last):
  File "/samba/bin/python/samba/tests/krb5/kdc_tgs_tests.py", line 2500, in test_renew_pac_request_false
    tgt = self._modify_tgt(tgt, renewable=True)
  File "samba/bin/python/samba/tests/krb5/kdc_tgs_tests.py", line 3014, in _modify_tgt
    return self.modified_ticket(
  File "/samba/bin/python/samba/tests/krb5/raw_testcase.py", line 5694, in modified_ticket
    auth_data, new_pac,
UnboundLocalError: local variable 'new_pac' referenced before assignment

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove ‘asserted_identity’ parameter from samba_kdc_get_user_info_dc()
Joseph Sutton [Wed, 27 Sep 2023 03:52:59 +0000 (16:52 +1300)] 
s4:kdc: Remove ‘asserted_identity’ parameter from samba_kdc_get_user_info_dc()

It was not used.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Have callers of samba_kdc_get_user_info_dc() themselves add an Asserted Ident...
Joseph Sutton [Wed, 27 Sep 2023 03:38:23 +0000 (16:38 +1300)] 
s4:kdc: Have callers of samba_kdc_get_user_info_dc() themselves add an Asserted Identity SID

samba_kdc_get_user_info_dc() does too much. It should be responsible
only for getting account information, not for adding extra SIDs.

By extracting the call to samba_kdc_add_asserted_identity() into the
former function’s callers, we’ll be able to remove the
‘asserted_identity’ parameter in the next commit, reducing the
function’s complexity.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove ‘claims_valid’ parameter from samba_kdc_get_user_info_dc()
Joseph Sutton [Wed, 27 Sep 2023 03:18:56 +0000 (16:18 +1300)] 
s4:kdc: Remove ‘claims_valid’ parameter from samba_kdc_get_user_info_dc()

It was not used.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Have callers of samba_kdc_get_user_info_dc() themselves add the Claims Valid SID
Joseph Sutton [Wed, 27 Sep 2023 03:23:33 +0000 (16:23 +1300)] 
s4:kdc: Have callers of samba_kdc_get_user_info_dc() themselves add the Claims Valid SID

samba_kdc_get_user_info_dc() does too much. It should be responsible
only for getting account information, not for adding extra SIDs.

By extracting the call to samba_kdc_add_claims_valid() into the former
function’s callers, we’ll be able to remove the ‘claims_valid’ parameter
in the next commit, reducing the function’s complexity.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove ‘compounded_auth’ parameter from samba_kdc_get_user_info_dc()
Joseph Sutton [Wed, 27 Sep 2023 03:12:50 +0000 (16:12 +1300)] 
s4:kdc: Remove ‘compounded_auth’ parameter from samba_kdc_get_user_info_dc()

It was never used.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove unused memory context from samba_kdc_lookup_realm()
Joseph Sutton [Wed, 27 Sep 2023 02:58:55 +0000 (15:58 +1300)] 
s4:kdc: Remove unused memory context from samba_kdc_lookup_realm()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add parameters for claims and device info to authn_policy_authenticate_to_ser...
Joseph Sutton [Wed, 27 Sep 2023 02:49:59 +0000 (15:49 +1300)] 
s4:kdc: Add parameters for claims and device info to authn_policy_authenticate_to_service()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add claims parameter to authn_policy_authenticate_from_device()
Joseph Sutton [Wed, 27 Sep 2023 02:47:06 +0000 (15:47 +1300)] 
s4:kdc: Add claims parameter to authn_policy_authenticate_from_device()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Add parameters for claims and device info to authn_policy_access_check()
Joseph Sutton [Wed, 27 Sep 2023 02:44:56 +0000 (15:44 +1300)] 
s4:kdc: Add parameters for claims and device info to authn_policy_access_check()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:auth: Add parameters for claims and device info to auth_generate_security_token()
Joseph Sutton [Wed, 27 Sep 2023 02:16:21 +0000 (15:16 +1300)] 
s4:auth: Add parameters for claims and device info to auth_generate_security_token()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Reformat function call
Joseph Sutton [Wed, 27 Sep 2023 02:20:04 +0000 (15:20 +1300)] 
s4:kdc: Reformat function call

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:auth: Reformat function calls
Joseph Sutton [Wed, 27 Sep 2023 02:11:20 +0000 (15:11 +1300)] 
s4:auth: Reformat function calls

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:auth: Rename parameter to match function implementation
Joseph Sutton [Wed, 27 Sep 2023 02:08:26 +0000 (15:08 +1300)] 
s4:auth: Rename parameter to match function implementation

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:dsdb: Add session info flag to indicate authentication with a device
Joseph Sutton [Wed, 27 Sep 2023 01:54:06 +0000 (14:54 +1300)] 
s4:dsdb: Add session info flag to indicate authentication with a device

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:dsdb: Add parameters for claims and device SIDs to security_token_create()
Joseph Sutton [Wed, 27 Sep 2023 01:51:36 +0000 (14:51 +1300)] 
s4:dsdb: Add parameters for claims and device SIDs to security_token_create()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopidl: Parenthesize expression to be cast
Joseph Sutton [Mon, 10 May 2021 22:27:33 +0000 (10:27 +1200)] 
pidl: Parenthesize expression to be cast

We must parenthesize each expression that is to be cast to a specific
type, otherwise the cast will apply to only part of the full expression.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agondr: Parenthesize expressions to be cast
Joseph Sutton [Tue, 4 May 2021 02:09:44 +0000 (14:09 +1200)] 
ndr: Parenthesize expressions to be cast

We must parenthesize each expression that is to be cast to a specific
type, otherwise the cast will apply to only part of the full expression.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Initialize pointer to NULL
Joseph Sutton [Wed, 27 Sep 2023 01:10:44 +0000 (14:10 +1300)] 
s4:kdc: Initialize pointer to NULL

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Remove unnecessary assignments
Joseph Sutton [Wed, 27 Sep 2023 01:00:07 +0000 (14:00 +1300)] 
s4:kdc: Remove unnecessary assignments

These structures have been zero‐initialized already.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Check that principal being copied is not NULL
Joseph Sutton [Wed, 27 Sep 2023 00:59:32 +0000 (13:59 +1300)] 
s4:kdc: Check that principal being copied is not NULL

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Prefer explicit initialization to ZERO_STRUCTP()
Joseph Sutton [Wed, 27 Sep 2023 00:58:31 +0000 (13:58 +1300)] 
s4:kdc: Prefer explicit initialization to ZERO_STRUCTP()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years ago.gitattributes: Mark large data file as binary
Joseph Sutton [Wed, 27 Sep 2023 00:38:36 +0000 (13:38 +1300)] 
.gitattributes: Mark large data file as binary

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:krb5_wrap: Include missing headers
Joseph Sutton [Wed, 27 Sep 2023 00:13:39 +0000 (13:13 +1300)] 
lib:krb5_wrap: Include missing headers

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:auth: Ensure that some parameters are not NULL
Joseph Sutton [Tue, 26 Sep 2023 00:34:56 +0000 (13:34 +1300)] 
s4:auth: Ensure that some parameters are not NULL

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: Handle new ACE types with sec_ace_object()
Joseph Sutton [Sun, 30 Jul 2023 22:55:42 +0000 (10:55 +1200)] 
libcli/security: Handle new ACE types with sec_ace_object()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: Have security_ace_equal() handle callback and resource ACEs
Joseph Sutton [Sun, 30 Jul 2023 22:52:32 +0000 (10:52 +1200)] 
libcli/security: Have security_ace_equal() handle callback and resource ACEs

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: Parenthesize macro parameter
Joseph Sutton [Wed, 19 Jul 2023 00:28:11 +0000 (12:28 +1200)] 
libcli/security: Parenthesize macro parameter

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: Conform to Samba’s brace style
Joseph Sutton [Wed, 19 Jul 2023 00:15:15 +0000 (12:15 +1200)] 
libcli/security: Conform to Samba’s brace style

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture: Fix building with FORTIFY_SOURCE=2
Joseph Sutton [Thu, 28 Sep 2023 03:51:38 +0000 (16:51 +1300)] 
s4:torture: Fix building with FORTIFY_SOURCE=2

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:ntvfs: Fix building with FORTIFY_SOURCE=2
Joseph Sutton [Thu, 28 Sep 2023 03:50:29 +0000 (16:50 +1300)] 
s4:ntvfs: Fix building with FORTIFY_SOURCE=2

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>