summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2023-10-16gpupdate: Test Drive Maps Client Side ExtensionDavid Mulder3-1/+226
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13tests/krb5: Fix assertion messagesJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13tests/krb5: Use assertEqual() instead of assertEquals()Joseph Sutton1-3/+3
assertEquals() was removed in Python 3.12. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Use now() instead of utcnow()Joseph Sutton1-2/+2
utcnow() is deprecated and will be removed in a future version of Python. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Remove semicolonsJoseph Sutton7-28/+28
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Correct search expressionJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Fix commentJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Fix exception messageJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Use assertEqual() instead of assertEquals()Joseph Sutton3-14/+14
assertEquals() was removed in Python 3.12. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:subunit: Use now() instead of utcnow()Joseph Sutton1-1/+1
utcnow() is deprecated and will be removed in a future version of Python. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:colour: Fix exception messageJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-12tests/krb5: Correctly test services that do not support Compound IdentityJoseph Sutton2-24/+7
These two tests now pass against Windows. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-10tests: Add reproducer for bug 15487Volker Lendecke1-0/+21
Show that smbd crashes if asked to return full information on close of a stream handle with delete on close disposition set. Bug: https://bugzilla.samba.org/show_bug.cgi?id=15487 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-10-01tests/krb5: Test that the correct Asserted Identity SID is added when inner ↵Joseph Sutton1-0/+60
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
2023-10-01tests/krb5: Add Device Restriction tests for silos and authentication ↵Joseph Sutton1-0/+625
policies in the KDC Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-01tests/krb5: Add tests performing AS‐REQs armored with unacceptable ticketsJoseph Sutton1-0/+33
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-01tests/krb5: Add method to perform an armored AS‐REQJoseph Sutton2-0/+119
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-01tests/krb5: Initialize variableJoseph Sutton1-1/+1
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>
2023-09-29samba-tool: Fix for gpo restore not working without --tmpdirKacper1-0/+9
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
2023-09-29netcmd: tests: add some tests for valid and invalid SDDL in cli commandsRob van der Linde1-0/+32
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>
2023-09-29netcmd: auth: add new SDDL fields to create and modify auth policy commandsRob van der Linde1-4/+65
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>
2023-09-29netcmd: models: add SDDL fields to AuthenticationPolicy modelRob van der Linde1-1/+12
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>
2023-09-29netcmd: models: add SDDL model fieldRob van der Linde2-1/+72
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>
2023-09-29netcmd: models: add FieldError subclass which stores the fieldRob van der Linde2-3/+15
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>
2023-09-29netcmd: models: field to_db_value needs ldb paramRob van der Linde3-16/+24
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>
2023-09-29netcmd: tests: modify auth silo cli tests setup their own test dataRob van der Linde1-15/+29
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>
2023-09-29netcmd: tests: modify auth policy cli tests setup their own test dataRob van der Linde1-28/+71
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>
2023-09-29netcmd: tests: modify claim cli tests setup their own test dataRob van der Linde1-39/+46
Initially the test data was created in setUp, but it was moved to setUpClass. The problem with this is tests modifying objects, which could affect the next test. Create all required data in the test itself for clarity (and also is faster) 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>
2023-09-29netcmd: tests: test that create objects make use of addCleanupRob van der Linde3-0/+46
Since the samdb connection is on the class and hangs around between tests, we need to clean up what we created. 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>
2023-09-29netcmd: tests: tests tidyup and make use of setUpTestDataRob van der Linde5-142/+99
Still only load the test data once per test class, but much easier to read. Made several methods static for creating/deleting claims, policies and silos. 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>
2023-09-29netcmd: tests: make _run a classmethod in SambaToolCmdTestRob van der Linde4-9/+13
So that it can be called from setUpClass as well 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>
2023-09-29python: tests: implement setUpTestData overridable class methodRob van der Linde1-0/+54
On Python 3.6 and 3.7 the addClassCleanup method needs to be implemented, and tearDownClass must be called by setupClass if any exception is raised. On Python 3.8 and higher, unittest already calls tearDownClass, even if it raises an exception in setUpClass. 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>
2023-09-29netcmd: tests: avoid the need to create a random command in GetSamDBRob van der Linde1-21/+10
Also the code that looks over kwargs is somewhat confusing and unnecessary. 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>
2023-09-28tests/krb5: Add samba.tests.krb5.conditional_ace_testsJoseph Sutton2-0/+3751
This is a test using conditional ACEs and claims to confirm that we understand the full end-to-end network behaviour of these all the way from the PAC to the application in the access check of the KDC. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Pair-programmed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Sep 28 04:35:05 UTC 2023 on atb-devel-224
2023-09-28tests/krb5: Add method to replace client or device claims in a PACJoseph Sutton1-0/+102
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Add method to replace the device SIDs in a PACJoseph Sutton1-0/+139
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Have set_pac_sids() accept lone RIDs as well as full SIDsJoseph Sutton1-3/+12
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Make optional ‘domain_sid’ parameter to set_pac_sids()Joseph Sutton1-1/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Make optional ‘user_rid’ parameter to set_pac_sids()Joseph Sutton1-4/+6
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Make set_pac_sids() parameters keyword‐onlyJoseph Sutton1-0/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Allow passing mapping=None to map_to_sid()Joseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Don’t bother regenerating the PAC if modify_pac_fn or ↵Joseph Sutton1-10/+18
update_pac_checksums are false Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Allow multiple ticket modification functionsJoseph Sutton1-3/+9
This means that callers can specify a stack of possible modifications. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Allow filter for tests that crash WindowsJoseph Sutton1-0/+6
Set CRASH_WINDOWS=0 when running against a Windows DC. These crashes are only possible because we can modify the PAC, but having these tests allows us to lock down Samba behaviour, so we include them. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Allow variation in PADATA_PW_SALTJoseph Sutton1-1/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-28tests/krb5: Sort importsJoseph Sutton2-14/+14
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27python:tests: Remove unused importJoseph Sutton1-1/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27python:tests: Fix invalid escape sequencesJoseph Sutton3-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27tests/krb5: Match filter after transforming test nameJoseph Sutton3-4/+4
If you just want to rerun a single test that failed, this removes the need to successfully guess its untransformed name. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-26python: Change the generic merge_nt_token() to being specific to the ↵Andrew Bartlett1-6/+7
system_token This allows us to punt on the question of merging the claims, as there are none on the system token. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>