]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 years agopython:tests: Complete assertion messages
Joseph Sutton [Fri, 25 Aug 2023 01:58:39 +0000 (13:58 +1200)] 
python:tests: Complete assertion messages

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:tests: Fix usage line
Joseph Sutton [Thu, 24 Aug 2023 23:57:09 +0000 (11:57 +1200)] 
python:tests: Fix usage line

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython: Fix reference to undefined name ‘samba’
Joseph Sutton [Mon, 28 Aug 2023 01:15:10 +0000 (13:15 +1200)] 
python: Fix reference to undefined name ‘samba’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: Remove useless return
Joseph Sutton [Fri, 25 Aug 2023 00:51:43 +0000 (12:51 +1200)] 
samba-tool: Remove useless return

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:join: Fix references to undefined variables
Joseph Sutton [Mon, 28 Aug 2023 01:11:21 +0000 (13:11 +1200)] 
python:join: Fix references to undefined variables

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython: Fix invalid escape sequences
Joseph Sutton [Fri, 25 Aug 2023 01:56:21 +0000 (13:56 +1200)] 
python: Fix invalid escape sequences

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython: Remove redundant backslashes
Joseph Sutton [Fri, 25 Aug 2023 01:55:23 +0000 (13:55 +1200)] 
python: Remove redundant backslashes

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython: Remove unused imports
Joseph Sutton [Thu, 24 Aug 2023 23:09:52 +0000 (11:09 +1200)] 
python: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython: Fix spelling
Joseph Sutton [Tue, 29 Aug 2023 02:23:51 +0000 (14:23 +1200)] 
python: Fix spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoldb: Heed return code from Python testsuite
Joseph Sutton [Tue, 29 Aug 2023 08:50:32 +0000 (20:50 +1200)] 
ldb: Heed return code from Python testsuite

When we added a second run of the Python testsuite, the return code from
the first run began to go ignored.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoldb: Remove unused import
Joseph Sutton [Tue, 29 Aug 2023 08:50:13 +0000 (20:50 +1200)] 
ldb: Remove unused import

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:ldb:tests: Remove explicit comparison with False
Joseph Sutton [Tue, 29 Aug 2023 08:48:58 +0000 (20:48 +1200)] 
lib:ldb:tests: Remove explicit comparison with False

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agobuildtools: Properly set global variable
Joseph Sutton [Tue, 29 Aug 2023 08:48:14 +0000 (20:48 +1200)] 
buildtools: Properly set global variable

Since we didn’t declare ‘old_refill_task_list’ as global, we were just
assigning a value to a local variable that was destroyed after we
returned from this function. We clearly intended instead to assign to a
global variable of the same name.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agobuildtools: Prefer ‘x not in y’ to ‘not x in y’
Joseph Sutton [Tue, 29 Aug 2023 03:10:53 +0000 (15:10 +1200)] 
buildtools: Prefer ‘x not in y’ to ‘not x in y’

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agobuildtools: Use ‘is’ to compare with singletons
Joseph Sutton [Tue, 29 Aug 2023 03:12:27 +0000 (15:12 +1200)] 
buildtools: Use ‘is’ to compare with singletons

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agobuildtools: Fix comments and documentation
Joseph Sutton [Tue, 29 Aug 2023 02:22:58 +0000 (14:22 +1200)] 
buildtools: Fix comments and documentation

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: Fix leaks
Joseph Sutton [Tue, 29 Aug 2023 21:47:28 +0000 (09:47 +1200)] 
pyldb: Fix leaks

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: Check return values of Python functions
Joseph Sutton [Fri, 25 Aug 2023 02:20:50 +0000 (14:20 +1200)] 
pyldb: Check return values of Python functions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: Check return values of talloc functions
Joseph Sutton [Fri, 25 Aug 2023 02:22:15 +0000 (14:22 +1200)] 
pyldb: Check return values of talloc functions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: Check whether Python object is a list
Joseph Sutton [Fri, 25 Aug 2023 02:21:24 +0000 (14:21 +1200)] 
pyldb: Check whether Python object is a list

If we’re going to call PyList_Size() on an object, we should be sure
that it is a list first.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agogp: Send list of keys instead of dict to remove
Gabriel Nagy [Wed, 16 Aug 2023 09:33:59 +0000 (12:33 +0300)] 
gp: Send list of keys instead of dict to remove

`cache_get_all_attribute_values` returns a dict whereas we need to pass
a list of keys to `remove`. These will be interpolated in the gpdb search.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Aug 28 03:01:22 UTC 2023 on atb-devel-224

2 years agogp: Test disabled enrollment unapplies policy
Gabriel Nagy [Fri, 18 Aug 2023 14:26:59 +0000 (17:26 +0300)] 
gp: Test disabled enrollment unapplies policy

For this we need to stage a Registry.pol file with certificate
autoenrollment enabled, but with checkboxes unticked.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Template changes should invalidate cache
Gabriel Nagy [Wed, 16 Aug 2023 09:37:17 +0000 (12:37 +0300)] 
gp: Template changes should invalidate cache

If certificate templates are added or removed, the autoenroll extension
should react to this and reapply the policy. Previously this wasn't
taken into account.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Test adding new cert templates enforces changes
Gabriel Nagy [Fri, 18 Aug 2023 14:16:23 +0000 (17:16 +0300)] 
gp: Test adding new cert templates enforces changes

Ensure that cepces-submit reporting additional templates and re-applying
will enforce the updated policy.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Convert CA certificates to base64
Gabriel Nagy [Wed, 16 Aug 2023 09:20:11 +0000 (12:20 +0300)] 
gp: Convert CA certificates to base64

I don't know whether this applies universally, but in our case the
contents of `es['cACertificate'][0]` are binary, so cleanly converting
to a string fails with the following:

'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte

We found a fix to be encoding the certificate to base64 when
constructing the CA list.

Section 4.4.5.2 of MS-CAESO also suggests that the content of
`cACertificate` is binary (OCTET string).

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Test with binary content for certificate data
Gabriel Nagy [Fri, 18 Aug 2023 14:06:43 +0000 (17:06 +0300)] 
gp: Test with binary content for certificate data

This fails all GPO-related tests that call `gpupdate --rsop`.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Change root cert extension suffix
Gabriel Nagy [Fri, 11 Aug 2023 15:46:42 +0000 (18:46 +0300)] 
gp: Change root cert extension suffix

On Ubuntu, certificates must end in '.crt' in order to be considered by
the `update-ca-certificates` helper.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Support update-ca-trust helper
Gabriel Nagy [Wed, 16 Aug 2023 22:09:28 +0000 (01:09 +0300)] 
gp: Support update-ca-trust helper

This is used on RHEL/Fedora instead of update-ca-certificates. They
behave similarly so it's enough to change the command name.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agogp: Support more global trust directories
Gabriel Nagy [Wed, 16 Aug 2023 22:05:54 +0000 (01:05 +0300)] 
gp: Support more global trust directories

In addition to the SUSE global trust directory, add support for RHEL and
Debian-based distributions (including Ubuntu).

To determine the correct directory to use, we iterate over the variants
and stop at the first which is a directory.

In case none is found, fallback to the first option which will produce a
warning as it did previously.

Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@samba.org>
2 years agosamba-tool: Allow LDB URL to be None
Joseph Sutton [Fri, 25 Aug 2023 00:14:23 +0000 (12:14 +1200)] 
samba-tool: Allow LDB URL to be None

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agowaf: Build nmbd with -Wno-error=stringop-overflow
Andreas Schneider [Tue, 22 Aug 2023 13:52:16 +0000 (15:52 +0200)] 
waf: Build nmbd with -Wno-error=stringop-overflow

We use strlcpy() which has been added to glibc recently. This means we
also get fortification for strlcpy() now:

source3/nmbd/nmbd_browsesync.c: In function ‘find_domain_master_name_query_success’:
source3/nmbd/nmbd_browsesync.c:337:9: warning: ‘strlcpy’ writing 257 bytes into a
region of size 16 overflows the destination [-Wstringop-overflow=]
  337 |         strlcpy(userdata->data, work->work_group, size - sizeof(*userdata));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We allocate memory for the userdata struct + fstring. However the data
pointer we use only is 16 bytes. Also nowadays you would use offsetof()
for the allocation calculation, but it only works correctly on newer
compilers like gcc > 7. We could make use of it in future after CentOS 7
is gone.

As we don't want to touch nmbd anymore, just silence the warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoutil: Avoid logging to multiple backends for stdout/stderr
Martin Schwenke [Wed, 26 Jul 2023 10:43:37 +0000 (20:43 +1000)] 
util: Avoid logging to multiple backends for stdout/stderr

Commit 83fe7a0316d3e5867a56cfdc51ec17f36ea03889 converted the
stdout/stderr logging  types to DEBUG_FILE to get a header when using
DEBUG_SYSLOG_FORMAT_ALWAYS.  However, this causes all configured
backends to be invoked.  When syslog is one of those backends then
this is almost certainly not what is intended.

Instead, call debug_file_log() directly in that special case and
revert the parts of the above commit that convert to file logging.

Most of the changes to debughdrclass() still seem necessary, since
they handle the change of debug_syslog_format from a bool to an enum.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Aug 28 01:21:07 UTC 2023 on atb-devel-224

2 years agoselftest:ndrdump: adjust xattr_NTACL test for ACE coda
Douglas Bagnall [Mon, 21 Aug 2023 22:14:50 +0000 (10:14 +1200)] 
selftest:ndrdump: adjust xattr_NTACL test for ACE coda

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug 24 03:47:08 UTC 2023 on atb-devel-224

2 years agolibcli/security: rm unused sec_ace_copy()
Douglas Bagnall [Fri, 18 Aug 2023 04:04:51 +0000 (16:04 +1200)] 
libcli/security: rm unused sec_ace_copy()

Unused since 2014.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest: compare Samba vs Windows SDDL security descriptors
Douglas Bagnall [Wed, 9 Aug 2023 02:15:27 +0000 (14:15 +1200)] 
pytest: compare Samba vs Windows SDDL security descriptors

Can Samba understand Windows security descriptors? Does it parse SDDL
the same way?

Here we test on over 7000 SDDL/descriptor pairs and find the answer
is pleasing. In later commits we will add more tests using different
classes of ACE.

The test cases are derived from fuzz seeds, exported to Windows via
the script in the last commit, with the Windows descriptor bytes found
using libcli/security/tests/windows/windows-sddl-test.py.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: test helper script extracts fuzz SDDL
Douglas Bagnall [Fri, 11 Aug 2023 10:21:41 +0000 (22:21 +1200)] 
libcli/security: test helper script extracts fuzz SDDL

This allows us to try the fuzz seeds as SDDL on Windows, then test
that Samba matches Windows' security descriptors in the cases where
the SDDL compiles. This will find SDDL edge cases that might otherwise
be missed.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: move Windows test script to windows subdir
Douglas Bagnall [Thu, 17 Aug 2023 22:37:47 +0000 (10:37 +1200)] 
libcli/security: move Windows test script to windows subdir

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: rewrite SDDL tests for running on Windows
Douglas Bagnall [Thu, 3 Aug 2023 23:52:17 +0000 (11:52 +1200)] 
libcli/security: rewrite SDDL tests for running on Windows

This script never worked well because it had to shell out to
Powershell, which never worked well due to syntax conflicts and
Powershell's specialness. The attempted ctypes version did not work,
due to the difficulty in expressing things like "relative
PSECURITY_DESCRIPTOR" in ctypes.

It turns out that pywin32 is easy to install and use, and we can
extract the NDR bytes which is far more useful than just testing if
the SDDL parses.

On Windows:

1. install Python from python.org
2. run `pip install pywin32`
3. copy e.g. libcli/security/tests/data/conditional-aces.txt to Windows
4. run `python windows-sddl-tests.py conditional-aces.txt`
5. add `--help` to see how to export descriptor bytes.

The default output is a whole lot of multi-coloured text, indicating
what failed and what didn't.

With --export-json it writes a JSON file mapping SDDL strings to NDR
byte sequences, which can be used to compare with Samba's attempts. If
you are only interested in --export-json, you might also like --quiet.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython/colour: add a colour diff helper
Douglas Bagnall [Thu, 17 Aug 2023 02:20:12 +0000 (14:20 +1200)] 
python/colour: add a colour diff helper

Sometimes colour can help show what is different between two strings.

This is roughly the same as

`git diff --no-index --color-words=. <a> <b>`.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: add some test more Windows SDDL test strings
Douglas Bagnall [Fri, 4 Aug 2023 02:15:19 +0000 (14:15 +1200)] 
libcli/security: add some test more Windows SDDL test strings

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: script to turn token/descriptor pairs into sddl
Douglas Bagnall [Wed, 26 Jul 2023 05:50:22 +0000 (17:50 +1200)] 
libcli/security: script to turn token/descriptor pairs into sddl

We fuzz security descriptors in a couple of different ways, and this
maps seeds from one form into the other. The SDDL examples can also be
used in Windows tests.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: remove unused tmp_ctx in calculate_inherited_from_parent()
Douglas Bagnall [Fri, 18 Aug 2023 02:37:35 +0000 (14:37 +1200)] 
libcli/security: remove unused tmp_ctx in calculate_inherited_from_parent()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: avoid leak in calculate_inherited_from_parent()
Douglas Bagnall [Fri, 21 Jul 2023 02:35:45 +0000 (14:35 +1200)] 
libcli/security: avoid leak in calculate_inherited_from_parent()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: used sec_ace_object() in sddl encoding
Douglas Bagnall [Fri, 21 Jul 2023 04:58:45 +0000 (16:58 +1200)] 
libcli/security: used sec_ace_object() in sddl encoding

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibrpc/security.idl: adjust size calculations for upcoming ace types
Douglas Bagnall [Thu, 13 Jul 2023 09:31:50 +0000 (21:31 +1200)] 
librpc/security.idl: adjust size calculations for upcoming ace types

Soon we will get Conditional ACEs and Resource Attribute ACES, each of
which have trailing bytes at the end of the ACE. Here's a diagram:

              ____      The ACE size field may indicate a size bigger
  .type      /    |     than the known parts, even when you take
  .flags    /     |     rounding to a multiple of four into account.
  .size  --'      |     This extra data is meaningful in some ACEs.
  .access_mask    |
  .trustee (sid) _|  <- known data ends here.
                  :
   "coda"      ___:  <- the trailing part, Zero size unless the size
                        field points beyond the end of the known data.
Probably empty for ordinary ACE types.

Until now we have thrown away these extra bytes, because they have no
meaning in the ACE types we recognise. But with conditional and
resource attribute ACEs we need to catch and process these bytes, so
we add an extra field for that.

Thus we can drop the manually written ndr_pull_security_ace() that
discarded the trailing bytes, because we just allow it to be pulled
into an unused blob. In the very common case, the blob will be empty.

Microsoft does not use a common name across different ACE types to
describe this end-data -- "coda" is a Samba term.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security: sddl ACL decode avoids early splitting on parenthesis
Douglas Bagnall [Fri, 21 Jul 2023 04:51:53 +0000 (16:51 +1200)] 
libcli/security: sddl ACL decode avoids early splitting on parenthesis

Soon we will have Conditional ACEs and Resource Attribute ACEs. It is
expected --indeed mandatory-- that the SDDL representations of these
ACEs will contain parentheses, so we can't use '(' and ')' to decide
where ACEs stop and start.

This means shifting where we make a mutable copy of the SDDL string
from per-ACE to per-ACL, and allowing sddl_decode_ace() to decide when
its ACE is finished.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4/ntfvfs/pvfs_acl: initialise ACEs to zeroes
Douglas Bagnall [Tue, 22 Aug 2023 02:13:44 +0000 (14:13 +1200)] 
s4/ntfvfs/pvfs_acl: initialise ACEs to zeroes

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4/torture: initialise ACE structs to zero
Douglas Bagnall [Tue, 22 Aug 2023 02:12:46 +0000 (14:12 +1200)] 
s4/torture: initialise ACE structs to zero

Because soon these structs will have more members, which are typically
going to be zero.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest/sddl: tests for more invalid or weird cases
Douglas Bagnall [Thu, 27 Apr 2023 22:46:27 +0000 (10:46 +1200)] 
pytest/sddl: tests for more invalid or weird cases

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest/sddl: add option for case-insensitive tests
Douglas Bagnall [Fri, 18 Aug 2023 01:10:02 +0000 (13:10 +1200)] 
pytest/sddl: add option for case-insensitive tests

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest/sddl: environment option for exporting as fuzz seeds
Douglas Bagnall [Fri, 18 Aug 2023 01:09:13 +0000 (13:09 +1200)] 
pytest/sddl: environment option for exporting as fuzz seeds

We want realistic examples for sddl fuzzing seeds, and we want
realistic examples for sddl tests, so hopefully we only need to get
it right once.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest/sddl: replace/export tests based on environment vars
Douglas Bagnall [Thu, 10 Aug 2023 23:08:00 +0000 (11:08 +1200)] 
pytest/sddl: replace/export tests based on environment vars

We had a stupid system involving test functions with side-effects,
that needed to be enabled by editing the file. Now you get the same
effects by setting environment variables, the names of which you can
only learn by reading the file closely.

This works better because some stuff needs to happen at class-time
rather than instance-time.

Also the environment variables specify the import and export locations.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytests: add helper to grab a directory from environment
Douglas Bagnall [Fri, 7 Jul 2023 04:12:19 +0000 (16:12 +1200)] 
pytests: add helper to grab a directory from environment

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolibcli/security/pysecurity: use NULL to mean NULL in C
Douglas Bagnall [Fri, 14 Apr 2023 01:58:15 +0000 (13:58 +1200)] 
libcli/security/pysecurity: use NULL to mean NULL in C

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib/util: strhex_to_data_blob checks talloc
Douglas Bagnall [Thu, 10 Aug 2023 02:26:11 +0000 (14:26 +1200)] 
lib/util: strhex_to_data_blob checks talloc

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: libsmb: Add a missing return statement in the timeout case.
Jeremy Allison [Thu, 17 Aug 2023 00:24:37 +0000 (17:24 -0700)] 
s3: libsmb: Add a missing return statement in the timeout case.

Obvious fix (needs a malicious server to recreate).

Found by Robert Morris <rtm@lcs.mit.edu>

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Aug 23 09:29:51 UTC 2023 on atb-devel-224

2 years agos3:utils: Use lpcfg_set_cmdline() in vfstest
Pavel Kalugin [Mon, 7 Aug 2023 05:34:14 +0000 (08:34 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in vfstest

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in testparm
Pavel Kalugin [Mon, 7 Aug 2023 04:52:32 +0000 (07:52 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in testparm

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in smbstatus
Pavel Kalugin [Mon, 7 Aug 2023 04:48:22 +0000 (07:48 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in smbstatus

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Remove trailing spaces in smbcquotas; no changes
Pavel Kalugin [Mon, 7 Aug 2023 04:43:48 +0000 (07:43 +0300)] 
s3:utils: Remove trailing spaces in smbcquotas; no changes

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in smbcquotas
Pavel Kalugin [Mon, 7 Aug 2023 04:43:06 +0000 (07:43 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in smbcquotas

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Remove trailing spaces in smbcontrol; no changes
Pavel Kalugin [Mon, 7 Aug 2023 04:35:59 +0000 (07:35 +0300)] 
s3:utils: Remove trailing spaces in smbcontrol; no changes

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in smbcontrol
Pavel Kalugin [Mon, 7 Aug 2023 04:34:38 +0000 (07:34 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in smbcontrol

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Remove trailing spaces in smbcacls; no changes
Pavel Kalugin [Mon, 7 Aug 2023 04:26:40 +0000 (07:26 +0300)] 
s3:utils: Remove trailing spaces in smbcacls; no changes

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in smbcacls
Pavel Kalugin [Mon, 7 Aug 2023 04:25:28 +0000 (07:25 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in smbcacls

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in sharesec
Pavel Kalugin [Mon, 7 Aug 2023 04:20:58 +0000 (07:20 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in sharesec

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in regedit
Pavel Kalugin [Mon, 7 Aug 2023 04:17:28 +0000 (07:17 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in regedit

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in pdbedit
Pavel Kalugin [Mon, 7 Aug 2023 04:13:00 +0000 (07:13 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in pdbedit

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Remove trailing spaces in pdbedit; no changes
Pavel Kalugin [Mon, 7 Aug 2023 04:08:29 +0000 (07:08 +0300)] 
s3:utils: Remove trailing spaces in pdbedit; no changes

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in net
Pavel Kalugin [Mon, 7 Aug 2023 03:56:07 +0000 (06:56 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in net

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in mdsearch
Pavel Kalugin [Mon, 7 Aug 2023 03:32:14 +0000 (06:32 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in mdsearch

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in dbwrap_torture
Pavel Kalugin [Mon, 7 Aug 2023 03:24:47 +0000 (06:24 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in dbwrap_torture

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:utils: Use lpcfg_set_cmdline() in dbwrap_tool
Pavel Kalugin [Mon, 7 Aug 2023 03:20:26 +0000 (06:20 +0300)] 
s3:utils: Use lpcfg_set_cmdline() in dbwrap_tool

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:rpc_server: Use lpcfg_set_cmdline() in test_mdsparser_es
Pavel Kalugin [Sun, 6 Aug 2023 19:29:02 +0000 (22:29 +0300)] 
s3:rpc_server: Use lpcfg_set_cmdline() in test_mdsparser_es

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:rpcclient: Use lpcfg_set_cmdline()
Pavel Kalugin [Sun, 6 Aug 2023 19:19:26 +0000 (22:19 +0300)] 
s3:rpcclient: Use lpcfg_set_cmdline()

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoexamples: Use lpcfg_set_cmdline()
Pavel Kalugin [Sun, 6 Aug 2023 14:39:36 +0000 (17:39 +0300)] 
examples: Use lpcfg_set_cmdline()

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agos3:param: Use lpcfg_set_cmdline()
Pavel Kalugin [Sun, 6 Aug 2023 14:25:33 +0000 (17:25 +0300)] 
s3:param: Use lpcfg_set_cmdline()

Signed-off-by: Pavel Kalugin <pkalugin@inno.tech>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agovfs_aio_pthread: use SMB_VFS_NEXT_OPENAT() in aio_pthread_openat_fn()
MikeLiu [Tue, 22 Aug 2023 02:01:14 +0000 (10:01 +0800)] 
vfs_aio_pthread: use SMB_VFS_NEXT_OPENAT() in aio_pthread_openat_fn()

1. Set 'aio_allow_open' to false if fsp->fsp_flags.is_pathref
2. Move !(how->flags & O_CREAT) and !(how->flags & O_EXCL) up and set 'aio_allow_open' to false
3. Use SMB_VFS_NEXT_OPENAT() instead of openat() for disable async opens case.

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

Signed-off-by: MikeLiu <mikeliu@qnap.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Aug 22 17:44:00 UTC 2023 on atb-devel-224

2 years agolibcli: Add required #includes to smbXcli_base.h
Volker Lendecke [Mon, 21 Aug 2023 19:41:06 +0000 (21:41 +0200)] 
libcli: Add required #includes to smbXcli_base.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoclifuse: Use direct FSCC info level
Volker Lendecke [Mon, 21 Aug 2023 19:34:31 +0000 (21:34 +0200)] 
clifuse: Use direct FSCC info level

Avoid the magic -1000

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use tevent_req_nterror() properly
Volker Lendecke [Wed, 16 Aug 2023 09:59:03 +0000 (11:59 +0200)] 
libsmb: Use tevent_req_nterror() properly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Remove a duplicate TALLOC_FREE()
Volker Lendecke [Wed, 16 Aug 2023 13:45:32 +0000 (15:45 +0200)] 
libsmb: Remove a duplicate TALLOC_FREE()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use tevent_req_oom() where appropriate
Volker Lendecke [Wed, 16 Aug 2023 13:39:55 +0000 (15:39 +0200)] 
libsmb: Use tevent_req_oom() where appropriate

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Move cli_raw_ioctl() to torture3
Volker Lendecke [Wed, 16 Aug 2023 09:04:14 +0000 (11:04 +0200)] 
libsmb: Move cli_raw_ioctl() to torture3

Only used there.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Move cli_qpathinfo1() to torture3
Volker Lendecke [Mon, 21 Aug 2023 10:59:10 +0000 (12:59 +0200)] 
libsmb: Move cli_qpathinfo1() to torture3

It's only used there, and it clutters general code. Re-adding the
async flavor is trivial should it ever be required.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agotorture3: Avoid unused variables
Volker Lendecke [Mon, 21 Aug 2023 10:45:52 +0000 (12:45 +0200)] 
torture3: Avoid unused variables

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agosmbclient: Don't give up in allinfo if getting advanced info fails
Volker Lendecke [Mon, 21 Aug 2023 08:01:24 +0000 (10:01 +0200)] 
smbclient: Don't give up in allinfo if getting advanced info fails

Getting streams might fail, but further down getting reparse info
might succeed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use cli_smb2_qpathinfo_basic() in cli_getatr()
Volker Lendecke [Fri, 18 Aug 2023 14:15:19 +0000 (16:15 +0200)] 
libsmb: Use cli_smb2_qpathinfo_basic() in cli_getatr()

cli_smb2_qpathinfo_basic() uses the smb_create_returns and avoids a
round-trip.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use cli_smb2_qpathinfo() in cli_qpathinfo2()
Volker Lendecke [Fri, 18 Aug 2023 14:07:56 +0000 (16:07 +0200)] 
libsmb: Use cli_smb2_qpathinfo() in cli_qpathinfo2()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Use cli_smb2_qpathinfo() for streams
Volker Lendecke [Fri, 18 Aug 2023 13:47:20 +0000 (15:47 +0200)] 
libsmb: Use cli_smb2_qpathinfo() for streams

Remove sync cli_smb2_qpathinfo_streams() wrapper.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agolibsmb: Add cli_smb2_qpathinfo_send/recv()
Volker Lendecke [Fri, 30 Jun 2023 20:43:43 +0000 (22:43 +0200)] 
libsmb: Add cli_smb2_qpathinfo_send/recv()

Wrap the create/qfileinfo/close, to be used in next patches

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agoselftest: Report time at which testsuite starts
Joseph Sutton [Thu, 17 Aug 2023 01:29:41 +0000 (13:29 +1200)] 
selftest: Report time at which testsuite starts

With no call to report_time() preceding it,
PlainFormatter.start_testsuite() would always claim that no time had
elapsed prior to the first testsuite starting to run. This gave a
misleading impression of the time spent running the first testsuite. Now
the time will be consistent with that reported for subsequent
testsuites, and will properly include any time that test environments
took to start up.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug 22 00:36:52 UTC 2023 on atb-devel-224

2 years agoselftest: Fix subunit reporting the time incorrectly
Joseph Sutton [Thu, 17 Aug 2023 00:46:17 +0000 (12:46 +1200)] 
selftest: Fix subunit reporting the time incorrectly

Although report_time() would output the time in UTC, it neglected to
specify the timezone offset. Thus subunithelper.parse_results() would
interpret the time string it was given as being in local time.
TestProtocolClient.time() then converted that *back* into UTC, giving an
incorrect result (unless UTC is your local timezone).

Fix this by having report_time() indicate that the time zone is UTC.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Remove leftover from debugging
Joseph Sutton [Thu, 17 Aug 2023 01:42:47 +0000 (13:42 +1200)] 
selftest: Remove leftover from debugging

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Remove unused variable
Joseph Sutton [Wed, 16 Aug 2023 03:20:48 +0000 (15:20 +1200)] 
selftest: Remove unused variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Remove semicolon
Joseph Sutton [Wed, 16 Aug 2023 03:19:05 +0000 (15:19 +1200)] 
selftest: Remove semicolon

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:torture: Fix code spelling
Joseph Sutton [Wed, 2 Aug 2023 02:52:13 +0000 (14:52 +1200)] 
s4:torture: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:smb_server: Fix code spelling
Joseph Sutton [Tue, 1 Aug 2023 03:52:07 +0000 (15:52 +1200)] 
s4:smb_server: Fix code spelling

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Use smb_krb5_make_data()
Joseph Sutton [Wed, 16 Aug 2023 03:57:53 +0000 (15:57 +1200)] 
s4:kdc: Use smb_krb5_make_data()

smb_krb5_make_data() sets the magic field, which we were previously
ignoring. We should also not set krb5_data::length if krb5_data::data is
NULL.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:kdc: Use ‘krb5_error_code’ for return types
Joseph Sutton [Wed, 16 Aug 2023 03:57:00 +0000 (15:57 +1200)] 
s4:kdc: Use ‘krb5_error_code’ for return types

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