summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2023-06-14tests/krb5: Make use of KerberosCredentials.get_sid()Joseph Sutton10-270/+106
KerberosCredentials objects now keep track of their account’s SID, which removes the need to look it up with KDCBaseTest.get_objectSid(). Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Keep track of account SIDsJoseph Sutton2-1/+15
This prevents having to look them up in the database when tests need them. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Fix overlong linesJoseph Sutton1-3/+5
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Add a couple of authentication policy testsJoseph Sutton1-0/+38
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Test authentication logging of TGT lifetimesJoseph Sutton1-5/+17
It is useful to test a combination of device restrictions and TGT lifetime restrictions so that we can check what TGT lifetime values end up in the logs. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Cache created authentication policiesJoseph Sutton2-18/+40
View with ‘git show -b’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Keep track of the type of each created accountJoseph Sutton2-0/+8
This allows us to determine which parts of an authentication policy apply to a particular account, which will be necessary to test audit logging. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Properly expect authentication failuresJoseph Sutton1-8/+12
These authentications are actually failing (due to RESPONSE_TOO_BIG errors), but our authentication logging infrastructure hides this. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Make samba.tests.auth_log test executableJoseph Sutton1-0/+11
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14samba-tool ou: Remove unused variablesJoseph Sutton1-3/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14samba-tool ou: Remove unused importJoseph Sutton1-1/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14samba-tool: Fix typoJoseph Sutton1-1/+1
Found by Rob van der Linde <rob@catalyst.net.nz>. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14selftest: Assert trust realm is not NoneJoseph Sutton1-2/+1
This is consistent with the other tests in this file. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Factor out isRemote()Joseph Sutton1-22/+22
This makes waitForMessages() easier to read. View with ‘git show -b’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14python:safe_tarfile: Improve safe extract()Andreas Schneider1-11/+1
This also checks for symlinks and hardlinks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python:safe_tarfile: Implement safer extractall()Andreas Schneider1-0/+53
This also checks for symlinks and hardlinks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python:safe_tarfile: Set extraction_filter for pythons providing itAndreas Schneider1-14/+22
It should be available for Python >= 3.11.4 but also has been backported. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python:tests: Adopt safe_tarfile for extraction_filter raisesAndreas Schneider1-6/+21
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14selftest: Add unit tests of the DC startup FL check/update codeAndrew Bartlett2-1/+222
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python/tests: Make helpful, stateless methods @classmethod and @staticmethodAndrew Bartlett1-3/+5
This allows them to be used in setUpClass in tests. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14selftest: Split up tests in dsdb.py to avoid creating a user when not requiredAndrew Bartlett1-12/+23
Creating a user is CPU intensive, particularly when a password is set so avoid doing so if not required. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-10gp: Fix user apply failure when droping privsDavid Mulder1-1/+1
When dropping privileges, gpupdate errored: gpclass.py:1167: KeyError: "getpwnam(): name not found: <HOSTNAME> apply_gp was incorrectly passing the hostname instead of the username. 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): Sat Jun 10 10:46:28 UTC 2023 on atb-devel-224
2023-05-31sefltest: Improve getdcname test by confirming the _REQUIRED flag behavioursAndrew Bartlett1-2/+173
We do this by checking what the underlying CLDAP netlogon call returns. This also validates that behaviour. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-31selftest: Fix remaining incorrect references to 2012 -> 2012R2 FL in ↵Andrew Bartlett1-4/+4
GetDCNameEx test Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-31selftest: Change self.assertTrue(x is not None) -> self.assertIsNotNone(x)Andrew Bartlett1-30/+30
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-29selftest: Confirm that the flags like DS_DIRECTORY_SERVICE_9_REQUIRED workAndrew Bartlett1-0/+83
We need to confirm this both for forwarded requests, and also for requests direct to the possible DC. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon May 29 23:29:50 UTC 2023 on atb-devel-224
2023-05-29selftest: Rework samba.tests.getdcname not to use ncalrpcAndrew Bartlett1-1/+1
This test is able to operate over the network, which aids testing against a comparative windows DC. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-29selftest: Assert that we have a trust in samba.tests.getdcnameAndrew Bartlett1-18/+9
We must ensure this test cannot became inoperative because the environment it was run against has no trust. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-29python:tests: Ensure that we don’t overwrite testsJoseph Sutton1-2/+8
If the file iterator returns two entries with the same name, one may overwrite the other. script_iterator() currently ensures this won’t happen, but it pays to be safe. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Make script executableJoseph Sutton1-2/+6
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Initialize global variableJoseph Sutton1-0/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Remove unused importsJoseph Sutton1-2/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Exclude Python test directoriesJoseph Sutton1-36/+3
Practically all of our Kerberos tests are excluded already. Many of our tests aren’t marked as executable, and so aren’t being checked anyway. Rather than having a large list of exclusions which one may easily forget to update, just exclude the test directories. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Fix f-stringsJoseph Sutton1-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29samba-tool domain: Handle new NBT_SERVER_* flagsJoseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Remove debugging codeJoseph Sutton1-5/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Add missing call to tearDownClass()Joseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/audit_log: Add missing call to tearDown()Joseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Remove unnecessary checkJoseph Sutton1-4/+3
This attribute is always truthy. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/audit_log: Remove unnecessary checksJoseph Sutton1-6/+4
These attributes are always truthy. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Call discardMessages() on classJoseph Sutton2-2/+2
This makes it clearer that discardMessages() operates on the class. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Make discardMessages() more reliableJoseph Sutton1-4/+13
It can take two or three calls to msg_ctx.loop_once() before a message comes in. Make sure we get all of the messages. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Expect no messages when changing a non-existent user’s ↵Joseph Sutton1-7/+5
password These log messages come from setUp(), and the fact that we are getting them is merely a side-effect of the unreliability of discardMessages(). Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/audit_log: Make discardMessages() more reliableJoseph Sutton1-5/+12
It can take two or three calls to msg_ctx.loop_once() before a message comes in. Make sure we get all of the messages. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Correctly get lp_ctxJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Remove unneeded len() callJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/audit_log: Remove unneeded len() callJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Rename ‘self’ parameter to ‘cls’Joseph Sutton1-5/+5
This method operates on the class, not on an instance of that class. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Rename ‘self’ parameter to ‘cls’Joseph Sutton1-5/+5
This method operates on the class, not on an instance of that class. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Correctly check for GUIDJoseph Sutton1-1/+1
Pattern.match() only checks the starting portion of the string. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>