]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
3 years agos4:kdc: Fix typo
Joseph Sutton [Thu, 27 Apr 2023 01:48:53 +0000 (13:48 +1200)] 
s4:kdc: Fix typo

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Create account cache key only if needed
Joseph Sutton [Wed, 26 Apr 2023 22:44:12 +0000 (10:44 +1200)] 
tests/krb5: Create account cache key only if needed

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Delete non-resuable accounts as soon as possible
Joseph Sutton [Wed, 26 Apr 2023 22:43:01 +0000 (10:43 +1200)] 
tests/krb5: Delete non-resuable accounts as soon as possible

This helps to mitigate Samba’s slow account deletion.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos4:kdc: Use correct target principal name in log message
Joseph Sutton [Wed, 26 Apr 2023 00:52:06 +0000 (12:52 +1200)] 
s4:kdc: Use correct target principal name in log message

‘tmp’ has already been freed by this point.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agodocs-xml: Fix typos
Joseph Sutton [Mon, 24 Apr 2023 00:53:12 +0000 (12:53 +1200)] 
docs-xml: Fix typos

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoauth/credentials: Fix NULL dereference
Joseph Sutton [Sun, 23 Apr 2023 23:13:38 +0000 (11:13 +1200)] 
auth/credentials: Fix NULL dereference

We should not pass a NULL pointer to netlogon_creds_session_encrypt().

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Refactor _test_samlogon()
Joseph Sutton [Fri, 21 Apr 2023 01:25:58 +0000 (13:25 +1200)] 
tests/krb5: Refactor _test_samlogon()

Move logic specific to the Network logon into that branch, so it’s
easier to see what’s going on.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolib:util: Fix undefined bitshift
Joseph Sutton [Wed, 19 Apr 2023 22:44:41 +0000 (10:44 +1200)] 
lib:util: Fix undefined bitshift

runtime error: left shift of 65535 by 16 places cannot be represented in type 'int'

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoparam: Fix resource leak
Joseph Sutton [Wed, 19 Apr 2023 21:20:38 +0000 (09:20 +1200)] 
param: Fix resource leak

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopython/samba: Fix invalid escape sequence
Joseph Sutton [Wed, 19 Apr 2023 21:03:46 +0000 (09:03 +1200)] 
python/samba: Fix invalid escape sequence

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolib/http: Remove unused structure
Joseph Sutton [Wed, 19 Apr 2023 03:44:11 +0000 (15:44 +1200)] 
lib/http: Remove unused structure

This is just a typo of ‘struct loadparm_context’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Allow setting a servicePrincipalName on a user account
Joseph Sutton [Wed, 19 Apr 2023 01:01:55 +0000 (13:01 +1200)] 
tests/krb5: Allow setting a servicePrincipalName on a user account

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Fix parameter default
Joseph Sutton [Wed, 19 Apr 2023 01:00:53 +0000 (13:00 +1200)] 
tests/krb5: Fix parameter default

Now that add_dollar is honoured for all account types, we don’t want to
pass add_dollar=True for user accounts.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Remove unused parameter
Joseph Sutton [Tue, 18 Apr 2023 22:50:23 +0000 (10:50 +1200)] 
tests/krb5: Remove unused parameter

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Test that the salt for a managed service account is computed correctly
Joseph Sutton [Thu, 13 Apr 2023 23:53:13 +0000 (11:53 +1200)] 
tests/krb5: Test that the salt for a managed service account is computed correctly

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Allow creating managed service accounts
Joseph Sutton [Thu, 13 Apr 2023 23:51:31 +0000 (11:51 +1200)] 
tests/krb5: Allow creating managed service accounts

These will be useful for testing authentication policies.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopydsdb: Add Managed Service Accounts GUID constant
Joseph Sutton [Thu, 27 Apr 2023 04:13:55 +0000 (16:13 +1200)] 
pydsdb: Add Managed Service Accounts GUID constant

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibds: Add Managed Service Accounts well-known GUID
Joseph Sutton [Thu, 27 Apr 2023 04:12:30 +0000 (16:12 +1200)] 
libds: Add Managed Service Accounts well-known GUID

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Always heed the add_dollar parameter
Joseph Sutton [Thu, 13 Apr 2023 23:49:41 +0000 (11:49 +1200)] 
tests/krb5: Always heed the add_dollar parameter

Not just if the account to be created is a computer. This allows us to
create other types of accounts with a trailing dollar.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Remove unused import
Joseph Sutton [Thu, 13 Apr 2023 02:13:43 +0000 (14:13 +1200)] 
tests/krb5: Remove unused import

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos4:dsdb: Fix leak
Joseph Sutton [Mon, 10 Apr 2023 21:46:37 +0000 (09:46 +1200)] 
s4:dsdb: Fix leak

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Remove unneeded assertions
Joseph Sutton [Wed, 5 Apr 2023 23:47:17 +0000 (11:47 +1200)] 
tests/krb5: Remove unneeded assertions

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Allow creating an account with an assigned policy or silo
Joseph Sutton [Tue, 4 Apr 2023 23:21:39 +0000 (11:21 +1200)] 
tests/krb5: Allow creating an account with an assigned policy or silo

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Add method to create an authentication policy
Joseph Sutton [Sun, 2 Apr 2023 23:23:10 +0000 (11:23 +1200)] 
tests/krb5: Add method to create an authentication policy

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Generify protected users test methods
Joseph Sutton [Tue, 24 May 2022 07:55:03 +0000 (19:55 +1200)] 
tests/krb5: Generify protected users test methods

We can reuse them to test accounts restricted authentication in some
form or another.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Handle NT hashes being disabled
Joseph Sutton [Tue, 24 May 2022 07:11:22 +0000 (19:11 +1200)] 
tests/krb5: Handle NT hashes being disabled

If NT hashes are disabled, we should not expect the RC4 enctype to be
available for non-computer accounts.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Pass client credentials down into kdc_exchange_dict
Joseph Sutton [Wed, 5 Apr 2023 23:09:31 +0000 (11:09 +1200)] 
tests/krb5: Pass client credentials down into kdc_exchange_dict

These are useful inside the test infrastructure.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Remove test for OemChangePasswordUser2()
Joseph Sutton [Tue, 24 May 2022 07:36:30 +0000 (19:36 +1200)] 
tests/krb5: Remove test for OemChangePasswordUser2()

We don’t implement this anymore (since commit
0f53bfe7230c5e76f7ceb8baf98a9ef38a35356f).

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotests/krb5: Split out functions for testing logons and password changes
Joseph Sutton [Fri, 6 May 2022 03:24:21 +0000 (15:24 +1200)] 
tests/krb5: Split out functions for testing logons and password changes

This allows their use for testing other forms of restricted accounts.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agoauth/credentials: Allow resetting bind DN on Credentials object
Joseph Sutton [Thu, 28 Apr 2022 23:51:18 +0000 (11:51 +1200)] 
auth/credentials: Allow resetting bind DN on Credentials object

Passing None into set_bind_dn() now resets it.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibrpc: Always call ndr_push_compression_state_init() for compression
Andrew Bartlett [Mon, 1 May 2023 02:30:31 +0000 (14:30 +1200)] 
librpc: Always call ndr_push_compression_state_init() for compression

This allows the push routine to cache the chosen compression algorithm in
the struct ndr_compression_state in ndr->cstate and so, in claims, avoid
calling ndr_size_CLAIMS_SET_NDR() three times per compression (more in the
overall push).

As claims is now the primary use of the libndr compression code, this is
a reasonable tradeoff compared to the other callers who have more static
algorithm selections.

By removing the struct ndr_compression_state **state argument from
ndr_push_compression_state_init() we make clear that the ndr->cstate
belongs to this NDR context, and this context alone.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
3 years agolibrpc: Fix talloc hierarchy for ndr_compression_state
Andrew Bartlett [Mon, 1 May 2023 02:13:15 +0000 (14:13 +1200)] 
librpc: Fix talloc hierarchy for ndr_compression_state

The complexity of generic_mszip_free() is not needed, nor is a talloc
destructor required if the memory is correctly created in a tree.

Credit to OSS-Fuzz for showing the use-after-free

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57608

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
3 years agopython:descriptor: add missing schema 2019 aces in builtin and dns partition
Stefan Metzmacher [Mon, 17 Apr 2023 09:22:21 +0000 (09:22 +0000)] 
python:descriptor: add missing schema 2019 aces in builtin and dns partition

Note 'samba-tool domain functionalprep' won't fix them in the database,
while a fresh provision will add these.

This is needed in order that 'samba-tool dbcheck --reset-well-known-acls'
won't reset them after a modern provision and will fix them on an old
domain.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:utils: Move error-handling code into more suitable spot (CID 1524680)
Joseph Sutton [Wed, 5 Apr 2023 22:00:00 +0000 (10:00 +1200)] 
s3:utils: Move error-handling code into more suitable spot (CID 1524680)

The loop above would only exit once ‘c’ was equal to −1, and thus this
code could never be reached.

Also set ‘ok’ to false to indicate failure.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May  4 01:29:10 UTC 2023 on atb-devel-224

3 years agos3:utils: Use ‘int’ for popt parameters
Joseph Sutton [Mon, 1 May 2023 03:36:53 +0000 (15:36 +1200)] 
s3:utils: Use ‘int’ for popt parameters

Previously we were handing the addresses of bool parameters to popt for
POPT_ARG_NONE parameters. This is not supported, and popt was returning
POPT_ERROR_BADOPERATION for these parameters (not bundled popt, though,
nor on Debian or Ubuntu). Using integers instead ensures that these
addresses are aligned and sized as popt expects.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agos3:utils: Use floating-point arithmetic when result is assigned to a double
Joseph Sutton [Mon, 1 May 2023 02:15:26 +0000 (14:15 +1200)] 
s3:utils: Use floating-point arithmetic when result is assigned to a double

This avoids any loss of precision from performing an integer division.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
3 years agoctdb-recovery: Use correct struct ban_node_state type for state
Christof Schmitt [Tue, 2 May 2023 19:17:56 +0000 (12:17 -0700)] 
ctdb-recovery: Use correct struct ban_node_state type for state

If this codepath is hit, ctdb aborts with:

ctdb/server/ctdb_recovery_helper.c:2687: Type mismatch: name[struct ban_node_state] expected[struct node_ban_state]")
    at ../../lib/talloc/talloc.c:505

Fix this by using the correct type.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed May  3 08:04:09 UTC 2023 on atb-devel-224

3 years agos4:lib:policy: cleanup and handle errors in push_recursive()
Dmitry Antipov [Thu, 27 Apr 2023 15:37:29 +0000 (18:37 +0300)] 
s4:lib:policy: cleanup and handle errors in push_recursive()

Prefer 'char' and 'ssize_t' over 'int' for I/O-related
calls and handle more possible errors in push_recursive().

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Fri Apr 28 14:19:12 UTC 2023 on atb-devel-224

3 years agogp: Add site-dn fallback when rpc call fails
David Mulder [Wed, 19 Apr 2023 20:11:05 +0000 (14:11 -0600)] 
gp: Add site-dn fallback when rpc call fails

In testing I noticed that the rpc call for the
site name is failing when joined via SSSD. This
commit adds a fallback to check using the old
style method found in ads_site_dn_for_machine()
(which works, but doesn't obey the Group Policy
spec) if the rpc call fails.

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Apr 28 03:14:25 UTC 2023 on atb-devel-224

3 years agoAdd a WHATSNEW entry indicating libgpo py deprecation
David Mulder [Wed, 15 Mar 2023 19:46:58 +0000 (13:46 -0600)] 
Add a WHATSNEW entry indicating libgpo py deprecation

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

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agogpo: Group Policy tests require a s3 loadparam
David Mulder [Tue, 14 Mar 2023 21:35:01 +0000 (15:35 -0600)] 
gpo: Group Policy tests require a s3 loadparam

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

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agogpupdate: Deprecate libgpo.get_gpo_list
David Mulder [Tue, 14 Mar 2023 18:37:54 +0000 (12:37 -0600)] 
gpupdate: Deprecate libgpo.get_gpo_list

This is no longer used by gpupdate.

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

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agogpupdate: Implement get_gpo_list in python
David Mulder [Tue, 14 Mar 2023 17:21:02 +0000 (11:21 -0600)] 
gpupdate: Implement get_gpo_list in python

The ADS code in libgpo is buggy. Rewrite
get_gpo_list in python using SamDB.

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

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security/tests: test strings for windows and samba SDDL tests
Douglas Bagnall [Sun, 16 Apr 2023 06:13:55 +0000 (18:13 +1200)] 
libcli/security/tests: test strings for windows and samba SDDL tests

These are produced by editing `python/samba/test/sddl.py to enable
`test_write_test_strings`, the running `make test TESTS='sddl\\b'`.

The windows executable from the C file added in a recent commit can
run these tests using the `-i` flag.

The Samba sddl.py tests can be induced to use them too, but that is
only useful for showing they are still in sync.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3/utils: when encoding ace string use "FA", "FR", "FW", "FX" string rights
Noel Power [Thu, 25 Aug 2022 13:29:09 +0000 (14:29 +0100)] 
s3/utils: when encoding ace string use "FA", "FR", "FW", "FX" string rights

prior to this patch rights matching "FA", "FR", "FW", "FX" were
outputted as the hex string representing the bit value.

While outputting the hex string is perfectly fine, it makes it harder
to compare icacls output (which always uses the special string values)

Additionally adjust various tests to deal with use of shortcut access masks
as sddl format now uses FA, FR, FW & FX strings (like icalcs does) instead
of hex representation of the bit mask.

adjust
  samba4.blackbox.samba-tool_ntacl
  samba3.blackbox.large_acl
  samba.tests.samba_tool.ntacl
  samba.tests.ntacls
  samba.tests.posixacl

so various string comparisons of the sddl format now pass

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
[abartlet@samba.org Adapted to new stricter SDDL behaviour around leading zeros in hex
 numbers, eg 0x001]

3 years agos3/utils: value for ace_flags value "FA" is incorrect
Noel Power [Thu, 25 Aug 2022 12:52:56 +0000 (13:52 +0100)] 
s3/utils: value for ace_flags value "FA" is incorrect

value for FA should be 0x001f01ff  (instead of 0x00001ff)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agopytest:sddl: show the correct handling of the "FA" SDDL flag
Andrew Bartlett [Wed, 26 Apr 2023 05:00:17 +0000 (17:00 +1200)] 
pytest:sddl: show the correct handling of the "FA" SDDL flag

The "FA" flag should map to 0x1f01ff, and 0x1f01ff should be converted
back into "FA".

This will be fixed over the next couple of commits.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agopytest:sddl Samba had the wrong value for FA, now fix the tests
Andrew Bartlett [Wed, 26 Apr 2023 04:27:38 +0000 (16:27 +1200)] 
pytest:sddl Samba had the wrong value for FA, now fix the tests

The tests that were in SddlWindowsFlagsAreDifferent have the behaviour
we want, and as we aim for Samba flags no longer being different, we
shift them to SddlNonCanonical. The tests in SddlSambaDoesItsOwnThing
are removed because they showed Samba's old behaviour around FA.

This will create knownfails, which will be fixed by the commit fixing the
value of "FA".

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
3 years agolibcli:security:sddl: accept only 8-4-4-4-12 GUIDs
Douglas Bagnall [Tue, 25 Apr 2023 22:24:25 +0000 (10:24 +1200)] 
libcli:security:sddl: accept only 8-4-4-4-12 GUIDs

Before we would take strings in a variety of lengths and formats,
which is not what Windows does or [MS-DTYP] says.

This was found by looking at evolved fuzz seeds. Note the 16 and 32
byte sequences in GUID position below:

$ hd $(ls -t seeds/fuzz_sddl_parse/* | head -1)| head
00000000  44 3a 41 52 50 50 50 50  50 28 4f 4c 3b 3b 46 57  |D:ARPPPPP(OL;;FW|
00000010  3b 30 7e ff ff ff ff ff  ff ff 2d 31 38 f5 ff ff  |;0~.......-18...|
00000020  fb 3b 3b 52 43 29 28 4f  44 3b 3b 46 57 3b 3b 3b  |.;;RC)(OD;;FW;;;|
00000030  52 43 29 28 4f 44 3b 3b  46 57 3b 30 30 ff ff ff  |RC)(OD;;FW;00...|
00000040  fb 30 e9 9b 3c cf e6 f5  ff ff fb 3b 3b 52 43 29  |.0..<......;;RC)|
00000050  28 4f 44 3b 3b 46 57 43  52 3b 3b 3b 52 43 29 28  |(OD;;FWCR;;;RC)(|
00000060  4f 44 3b 3b 46 58 47 52  3b 3b 33 43 43 35 38 37  |OD;;FXGR;;3CC587|
00000070  32 35 44 44 44 44 44 44  44 44 44 44 44 44 44 44  |25DDDDDDDDDDDDDD|
00000080  44 44 44 44 44 44 44 44  44 44 3b 52 43 29 28 4f  |DDDDDDDDDD;RC)(O|
00000090  44 3b 3b 46 58 3b 3b 3b  52 43 29 28 4f 44 3b 3b  |D;;FX;;;RC)(OD;;|

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:large_ldap: use a valid ACE
Douglas Bagnall [Wed, 26 Apr 2023 00:40:22 +0000 (12:40 +1200)] 
pytest:large_ldap: use a valid ACE

Real ACEs don't have {} around their GUIDs. This will soon be banned.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: test we only accept normal GUIDs
Douglas Bagnall [Tue, 25 Apr 2023 22:33:12 +0000 (10:33 +1200)] 
pytest:sddl: test we only accept normal GUIDs

By normal GUID, I mean ones like f30e3bbf-9ff0-11d1-b603-0000f80367c1,
with four hyphens and no curly braces.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli:security:sddl_decode_access allows spaces between flags
Douglas Bagnall [Sun, 23 Apr 2023 00:36:35 +0000 (12:36 +1200)] 
libcli:security:sddl_decode_access allows spaces between flags

because Windows does.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: tests around spaces in access flags and SIDs
Douglas Bagnall [Sat, 22 Apr 2023 20:52:42 +0000 (08:52 +1200)] 
pytest:sddl: tests around spaces in access flags and SIDs

It turns out that in accesss flags Windows will allow leading spaces
and spaces separating flags but not trailing spaces.

We choose to follow this in part because we found it happening in the
wild in our tests for upgradeprovision until a few commits ago.

Windows will also allow spaces in some parts of SIDs.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl debugging: should_fail test says how it failed
Douglas Bagnall [Fri, 21 Apr 2023 12:48:30 +0000 (00:48 +1200)] 
pytest:sddl debugging: should_fail test says how it failed

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli:security: sddl_decode_ace: don't allow junk after SID
Douglas Bagnall [Fri, 21 Apr 2023 12:47:16 +0000 (00:47 +1200)] 
libcli:security: sddl_decode_ace: don't allow junk after SID

sddl_decode_sid() will stop at the first non-SID character. Windows
doesn't allow white space here, and nor do we.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: sddl_decode_access rejects trailing rubbish
Douglas Bagnall [Fri, 21 Apr 2023 03:47:32 +0000 (15:47 +1200)] 
libcli/security: sddl_decode_access rejects trailing rubbish

Before we just ignored things like negative numbers, because they'd
end up being seen as not-numbers, so treated as flags, then as
not-flags.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli:security: sddl_map_flags rejects trailing nonsense
Douglas Bagnall [Fri, 21 Apr 2023 03:47:10 +0000 (15:47 +1200)] 
libcli:security: sddl_map_flags rejects trailing nonsense

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:torture: sid2unixid2: DEBUG blames the right function
Douglas Bagnall [Wed, 19 Apr 2023 05:08:02 +0000 (17:08 +1200)] 
s3:torture: sid2unixid2: DEBUG blames the right function

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:torture:LOCAL-IDMAP-TDB-COMMON: avoid talloc stacktrace
Douglas Bagnall [Wed, 19 Apr 2023 04:37:53 +0000 (16:37 +1200)] 
s3:torture:LOCAL-IDMAP-TDB-COMMON: avoid talloc stacktrace

The short version is:

Running LOCAL-IDMAP-TDB-COMMON
test_getnewid1: PASSED!
test_setmap1: PASSED!
test_unixid2sid1: PASSED!
test_sid2unixid1: could not create uid map!
TEST LOCAL-IDMAP-TDB-COMMON FAILED!
LOCAL-IDMAP-TDB-COMMON took 0.029819 secs

Freed frame ../../source3/torture/torture.c:15748, expected ../../source3/torture/test_idmap_tdb_common.c:986.
===============================================================
INTERNAL ERROR: Frame not freed in order. in pid 3692106 (4.19.0pre1-DEVELOPERBUILD)
If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
===============================================================
PANIC (pid 3692106): Frame not freed in order. in 4.19.0pre1-DEVELOPERBUILD
BACKTRACE: 11 stack frames:
 #0 bin/shared/private/libgenrand-samba4.so(log_stack_trace+0x32) [0x7f2f39b430ba]
 #1 bin/shared/private/libgenrand-samba4.so(smb_panic_log+0x1dd) [0x7f2f39b43037]
 #2 bin/shared/private/libgenrand-samba4.so(smb_panic+0x1c) [0x7f2f39b43056]
 #3 bin/shared/libsamba-util.so.0(+0x75309) [0x7f2f3a659309]
 #4 bin/shared/private/libtalloc-samba4.so(+0x5cc6) [0x7f2f3a758cc6]
 #5 bin/shared/private/libtalloc-samba4.so(+0x6173) [0x7f2f3a759173]
 #6 bin/shared/private/libtalloc-samba4.so(_talloc_free+0x10c) [0x7f2f3a75a54b]
 #7 /data/samba/samba-review/bin/smbtorture3(main+0xa97) [0x55cb3dc8cedc]
 #8 /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f2f396d4d90]
 #9 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f2f396d4e40]
 #10 /data/samba/samba-review/bin/smbtorture3(_start+0x25) [0x55cb3dc59895]
smb_panic(): calling panic action [/data/samba/samba-review/selftest/gdb_backtrace 3692106]

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: add tests for long DACLs, differing flag interpretations
Douglas Bagnall [Mon, 17 Apr 2023 02:46:52 +0000 (14:46 +1200)] 
pytest:sddl: add tests for long DACLs, differing flag interpretations

Windows converts hex numbers into flags differently, and has different
ideas of what constitutes "FA", and possibly others.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: let hex numbers differ in case (0xa == 0xA)
Douglas Bagnall [Sun, 16 Apr 2023 06:43:40 +0000 (18:43 +1200)] 
pytest:sddl: let hex numbers differ in case (0xa == 0xA)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: helpers to exchange SDDL strings with Windows testprogram
Douglas Bagnall [Sat, 15 Apr 2023 08:29:53 +0000 (20:29 +1200)] 
pytest:sddl: helpers to exchange SDDL strings with Windows testprogram

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: SDDL parse tests to run on Windows
Douglas Bagnall [Wed, 22 Mar 2023 02:49:26 +0000 (15:49 +1300)] 
libcli/security: SDDL parse tests to run on Windows

The C version tests the public SDDL API on Windows which seems to follow
Active Directory closely, though case in hex numbers is reversed vis-a-vis
defaultSecurityDescriptor.

The python version is less refined and tests powershell functions.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: SDDL strings where Windows behaviour differs
Douglas Bagnall [Sat, 15 Apr 2023 08:32:30 +0000 (20:32 +1200)] 
pytest:sddl: SDDL strings where Windows behaviour differs

These ones we might want to match. They are understandable behaviours,
like matching lowercase flags and coping with whitespace in some
places. These tests are set up to document the differences without
overwhelming the knownfails.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: Add negative tests of unparseable strings
Douglas Bagnall [Sat, 15 Apr 2023 08:24:24 +0000 (20:24 +1200)] 
pytest:sddl: Add negative tests of unparseable strings

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: allow tests to make negative assertions
Douglas Bagnall [Sat, 15 Apr 2023 08:42:12 +0000 (20:42 +1200)] 
pytest:sddl: allow tests to make negative assertions

If the subclass has `should_succeed = False`, all the cases
in that class will be tested to ensure they can't be
successfully parsed.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: split each string into it's own test
Douglas Bagnall [Thu, 13 Apr 2023 03:59:32 +0000 (15:59 +1200)] 
pytest:sddl: split each string into it's own test

This of course allows for fine-grained knownfails.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: tweak some test strings
Douglas Bagnall [Sat, 22 Apr 2023 06:11:49 +0000 (18:11 +1200)] 
pytest:sddl: tweak some test strings

Adding, diversifying, and disambiguating. The leading portion of the
test stirngs will soon be used in the test name, and strings that
don't differ in the first hundred characters will cause naming
clashes. There is no good reason for them all to test the same flags
in the same order.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest/sddl: split tests into canonical and non-canonical
Douglas Bagnall [Thu, 13 Apr 2023 10:18:21 +0000 (22:18 +1200)] 
pytest/sddl: split tests into canonical and non-canonical

The examples in the canonical list are already in the form that
Windows and Samba will use for that SD. We check the round trip.

The examples in the non-canonical list will change in a round trip, so
we also give the string we think they should end up as. These have
been checked on Windows.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest/sddl: remove unused imports
Douglas Bagnall [Thu, 13 Apr 2023 11:18:04 +0000 (23:18 +1200)] 
pytest/sddl: remove unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest/sddl: rework to allow multiple lists, no early stop
Douglas Bagnall [Thu, 13 Apr 2023 13:00:18 +0000 (01:00 +1200)] 
pytest/sddl: rework to allow multiple lists, no early stop

The test will fail right now because it makes round trip assertions.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest/sddl: assert sddl string equality
Douglas Bagnall [Wed, 22 Mar 2023 03:31:10 +0000 (16:31 +1300)] 
pytest/sddl: assert sddl string equality

It's not that I think our SD equality check will miss anything, but we
are here to test things like that.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest/sddl: remove duplicate test case
Douglas Bagnall [Tue, 21 Mar 2023 00:10:52 +0000 (13:10 +1300)] 
pytest/sddl: remove duplicate test case

The other copy is on line 102.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest/sddl: give test more of a name
Douglas Bagnall [Tue, 21 Mar 2023 00:05:55 +0000 (13:05 +1300)] 
pytest/sddl: give test more of a name

I think it worked, but the convention is that tests have a test_ prefix,
and it woudn't be surpoising if something somewhere decides to depend on
that.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytests/sddl: clarify boundaries between sddl cases
Douglas Bagnall [Tue, 21 Mar 2023 00:02:13 +0000 (13:02 +1300)] 
pytests/sddl: clarify boundaries between sddl cases

It is now easier to see where one SD ends and another starts.

Best looked at with -b or --word-diff.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:posixacl: expect canonical ACE flag format
Douglas Bagnall [Mon, 17 Apr 2023 23:50:23 +0000 (11:50 +1200)] 
pytest:posixacl: expect canonical ACE flag format

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:samba-tool ntacl: expect canonical ACE flag format
Douglas Bagnall [Mon, 17 Apr 2023 23:44:04 +0000 (11:44 +1200)] 
pytest:samba-tool ntacl: expect canonical ACE flag format

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopy:provision: use canonical representation of ACE flags
Douglas Bagnall [Mon, 17 Apr 2023 23:42:57 +0000 (11:42 +1200)] 
py:provision: use canonical representation of ACE flags

This is because in ceetain places we compare strings rather than security
descriptors.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:ntacls: adapt for canonical flag format
Douglas Bagnall [Mon, 17 Apr 2023 23:16:03 +0000 (11:16 +1200)] 
pytest:ntacls: adapt for canonical flag format

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agos3:test_larg_acl: adapt for the canonical ACE flags format
Douglas Bagnall [Mon, 17 Apr 2023 23:52:29 +0000 (11:52 +1200)] 
s3:test_larg_acl: adapt for the canonical ACE flags format

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agotest:bb/samba-tool ntacl: let return acl flag lack hex padding
Douglas Bagnall [Mon, 17 Apr 2023 02:48:41 +0000 (14:48 +1200)] 
test:bb/samba-tool ntacl: let return acl flag lack hex padding

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: do not pad sddl flags with zeros
Douglas Bagnall [Fri, 24 Mar 2023 01:21:14 +0000 (14:21 +1300)] 
libcli/security: do not pad sddl flags with zeros

We don't see this happening on Windows.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: ace type is not enum not flags
Douglas Bagnall [Fri, 24 Mar 2023 03:18:44 +0000 (16:18 +1300)] 
libcli/security: ace type is not enum not flags

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: disallow sddl access masks greater than 32 bits
Douglas Bagnall [Tue, 11 Apr 2023 22:46:30 +0000 (10:46 +1200)] 
libcli/security: disallow sddl access masks greater than 32 bits

Our previous behaviour (at least with glibc) was to clip off the extra
bits, so that 0x123456789 would become 0x23456789. That's kind of the
obvious thing, but is not what Windows does, which is to saturate the
value, rounding to 0xffffffff. The effect of this is to turn on all
the flags, which quite possibly not what you meant.

Now we just return an error.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: allow decimal/octal numbers in SDDL access mask
Douglas Bagnall [Thu, 23 Mar 2023 21:28:09 +0000 (21:28 +0000)] 
libcli/security: allow decimal/octal numbers in SDDL access mask

This follows Windows and [MS-DTYP].

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolib/sec/sddl: allow empty non-trailing ACL with flags
Douglas Bagnall [Thu, 16 Mar 2023 08:17:56 +0000 (21:17 +1300)] 
lib/sec/sddl: allow empty non-trailing ACL with flags

The string "S:D:P" is parsed by us and Windows into a valid struct,
which has an empty DACL with the PROTECTED flag, and an empty SACL.
This is reconstructed in canonical order as "D:PS:", which Windows
will correctly parse, but Samba has assumed the "S" is a bad DACL
flag. Now we don't make that assumption.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sddl: test empty DACL with flags
Douglas Bagnall [Thu, 16 Mar 2023 23:19:00 +0000 (12:19 +1300)] 
pytest:sddl: test empty DACL with flags

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/sec/sddl decode: allow hex numbers in SIDs
Douglas Bagnall [Thu, 16 Mar 2023 02:46:08 +0000 (15:46 +1300)] 
libcli/sec/sddl decode: allow hex numbers in SIDs

These occur canonically when the indentifier authority is > 2^32, but
also are accepted by Windows for any number.

There is a tricky case with an "O:" or "G:" SID that is immediately
followed by a "D:" dacl, because the "D" looks like a hex digit. When
we detect this we need to subtract one from the length.

We also need to do look out for trailing garbage. This was not an
issue before because any string caught by the strspn(...,
"-0123456789") would be either rejected or fully comsumed by
dom_sid_parse_talloc(), but with hex digits, a string like
"S-1-1-2x0xabcxxx-X" would be successfully parsed as "S-1-1-2", and
the "x0xabcxxx-X" would be skipped over. That's why we switch to using
dom_sid_parse_endp(), so we can compare the consumed length to the
expected length.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/sec/sddl decode: don't ignore random junk.
Douglas Bagnall [Thu, 16 Mar 2023 02:44:11 +0000 (15:44 +1300)] 
libcli/sec/sddl decode: don't ignore random junk.

previously a string could have anything in it, so long as every second
character was ':'.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security/dom_sid: use (unsigned char) in isdigit()
Douglas Bagnall [Fri, 21 Apr 2023 03:32:01 +0000 (15:32 +1200)] 
libcli/security/dom_sid: use (unsigned char) in isdigit()

The man page notes:

       The standards require that the argument c for these functions
       is either EOF or a value that is representable in the type
       unsigned char.  If the argument c is of type char, it must be
       cast to unsigned char, as in the following example:

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security/dom_sid: hex but not octal is OK for sub-auth
Douglas Bagnall [Sun, 16 Apr 2023 00:21:16 +0000 (12:21 +1200)] 
libcli/security/dom_sid: hex but not octal is OK for sub-auth

Following Windows, the numbers that would be octal (e.g. "0123") are
converted to decimal by skipping over the zeros.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: avoid overflow in subauths
Douglas Bagnall [Tue, 11 Apr 2023 23:39:25 +0000 (11:39 +1200)] 
libcli/security: avoid overflow in subauths

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: stricter identauth parsing
Douglas Bagnall [Tue, 11 Apr 2023 23:38:24 +0000 (11:38 +1200)] 
libcli/security: stricter identauth parsing

We don't want octal numbers or overflows.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security: avoid overflow in revision number
Douglas Bagnall [Thu, 16 Mar 2023 02:42:52 +0000 (15:42 +1300)] 
libcli/security: avoid overflow in revision number

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agolibcli/security/dom_sid: remove a couple of lost comments
Douglas Bagnall [Thu, 16 Mar 2023 02:39:05 +0000 (15:39 +1300)] 
libcli/security/dom_sid: remove a couple of lost comments

The second one came with code obsoleting the "BIG NOTE" about 10 years
ago, but that code later wandered off somewhere else.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sid_strings: Do bad SIDs fail differently in simple-bind?
Douglas Bagnall [Thu, 13 Apr 2023 00:17:28 +0000 (12:17 +1200)] 
pytest:sid_strings: Do bad SIDs fail differently in simple-bind?

No.

That's good and expected because a failure here should fall back to the
next thing in the simple bind pecking order (canonical names).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sid_strings: do bad SIDS work in search filters?
Douglas Bagnall [Thu, 13 Apr 2023 00:13:26 +0000 (12:13 +1200)] 
pytest:sid_strings: do bad SIDS work in search filters?

Yes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sid_strings: test SID DNs with ldb parsing
Douglas Bagnall [Thu, 13 Apr 2023 00:11:48 +0000 (12:11 +1200)] 
pytest:sid_strings: test SID DNs with ldb parsing

By using an ldb.Dn as an intermediary, we get to see which SIDs
Samba thinks are OK but Windows thinks are bad.
It is things like "S-0-5-32-579".

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sid_strings: test SIDs as search base
Douglas Bagnall [Wed, 12 Apr 2023 23:21:38 +0000 (11:21 +1200)] 
pytest:sid_strings: test SIDs as search base

As a way of testing the interpretation of a SID string in a remote
server, we search on the base DN "<SID=x>" where x is a non-existent
or malformed SID.

On Windows some or all malformed SIDs are detected before the search
begins, resulting in a complaint about DN syntax rather than one about
missing objects.

From this we can get a picture of what Windows considers to be
a proper SID in this context.

Samba does not make a distinction here, always returning NO_SUCH_OBJECT.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
3 years agopytest:sid_strings: Windows and Samba divergent tests
Douglas Bagnall [Wed, 12 Apr 2023 01:31:40 +0000 (13:31 +1200)] 
pytest:sid_strings: Windows and Samba divergent tests

The Samba side is aspirational -- what we actually do is generally
worse. However the Windows behaviour in these cases seems more
surprising still, and seems to be neither documented nor used.

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