]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
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>
2 years agos3:smbd: Fix building with FORTIFY_SOURCE=2
Joseph Sutton [Thu, 28 Sep 2023 03:49:56 +0000 (16:49 +1300)] 
s3:smbd: Fix building with FORTIFY_SOURCE=2

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

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:libads: Don’t do first loop iteration if ‘attr’ is NULL
Joseph Sutton [Thu, 28 Sep 2023 03:45:19 +0000 (16:45 +1300)] 
s3:libads: Don’t do first loop iteration if ‘attr’ is NULL

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib/util: Fix building with FORTIFY_SOURCE=2
Joseph Sutton [Thu, 28 Sep 2023 03:39:07 +0000 (16:39 +1300)] 
lib/util: Fix building with FORTIFY_SOURCE=2

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

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:compression: Fix building with FORTIFY_SOURCE=2
Joseph Sutton [Thu, 15 Dec 2022 03:04:51 +0000 (16:04 +1300)] 
lib:compression: Fix building with FORTIFY_SOURCE=2

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: Fix for gpo restore not working without --tmpdir
Kacper [Wed, 30 Aug 2023 12:33:49 +0000 (14:33 +0200)] 
samba-tool: Fix for gpo restore not working without --tmpdir

cmd_restore depends on cmd_create but the later cleans up
required temp files for cmd_restore to function.

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

RN: Fix for gpo restore not working without --tmpdir

Signed-off-by: Kacper Boström <kacper@kacper.se>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Sep 29 03:15:18 UTC 2023 on atb-devel-224

2 years agolibcli/security: fix talloc context for integer values (CID 1545156)
Douglas Bagnall [Thu, 28 Sep 2023 23:35:10 +0000 (12:35 +1300)] 
libcli/security: fix talloc context for integer values (CID 1545156)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: test_run_condtional_ace: va_end() on errors
Douglas Bagnall [Thu, 28 Sep 2023 23:25:21 +0000 (12:25 +1300)] 
libcli/security: test_run_condtional_ace: va_end() on errors

CID 1545154, CID 1545155.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: conditional ACEs check again for NULL/empty claims
Douglas Bagnall [Thu, 28 Sep 2023 23:24:14 +0000 (12:24 +1300)] 
libcli/security: conditional ACEs check again for NULL/empty claims

CID 1545152.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: auth: manpage documentation for conditional ace fields
Rob van der Linde [Wed, 20 Sep 2023 23:41:02 +0000 (11:41 +1200)] 
netcmd: auth: manpage documentation for conditional ace fields

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: tests: add some tests for valid and invalid SDDL in cli commands
Rob van der Linde [Thu, 28 Sep 2023 02:33:18 +0000 (15:33 +1300)] 
netcmd: tests: add some tests for valid and invalid SDDL in cli commands

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: auth: add new SDDL fields to create and modify auth policy commands
Rob van der Linde [Wed, 20 Sep 2023 01:04:14 +0000 (13:04 +1200)] 
netcmd: auth: add new SDDL fields to create and modify auth policy commands

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: models: add SDDL fields to AuthenticationPolicy model
Rob van der Linde [Wed, 20 Sep 2023 01:02:21 +0000 (13:02 +1200)] 
netcmd: models: add SDDL fields to AuthenticationPolicy model

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: models: add SDDL model field
Rob van der Linde [Wed, 20 Sep 2023 00:52:31 +0000 (12:52 +1200)] 
netcmd: models: add SDDL model field

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: models: add FieldError subclass which stores the field
Rob van der Linde [Thu, 28 Sep 2023 02:22:17 +0000 (15:22 +1300)] 
netcmd: models: add FieldError subclass which stores the field

This is so that errors on the CLI show the field name

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: models: field to_db_value needs ldb param
Rob van der Linde [Wed, 20 Sep 2023 00:50:15 +0000 (12:50 +1200)] 
netcmd: models: field to_db_value needs ldb param

Required by SDDL field type added in next commit

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: tests: modify auth silo cli tests setup their own test data
Rob van der Linde [Thu, 28 Sep 2023 04:26:22 +0000 (17:26 +1300)] 
netcmd: tests: modify auth silo cli tests setup their own test data

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agonetcmd: tests: modify auth policy cli tests setup their own test data
Rob van der Linde [Thu, 28 Sep 2023 04:13:15 +0000 (17:13 +1300)] 
netcmd: tests: modify auth policy cli tests setup their own test data

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>