summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2023-05-29tests/audit_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>
2023-05-29tests/auth_log: Pre-compile GUID regexJoseph Sutton1-2/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/krb5: Don’t cache accounts with an assigned policy or siloJoseph Sutton1-0/+2
Such accounts are virtually never reused. Not caching them (thus deleting them early) grants significant time savings. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/krb5: Move TestCaseInTempDir to more appropriate place in class hierarchyJoseph Sutton2-4/+4
KDCBaseTest is the only class that makes use of it. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24pytest: dcerpc/dnsserver: Call setUpClass() method of base classJoseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24pytest: dcerpc/dnsserver: Remove unused importJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24tests/auth_log: Simplify isRemote()Joseph Sutton1-5/+7
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24tests/auth_log: Rename ‘self’ parameter to ‘cls’Joseph Sutton1-10/+10
This method operates on the class, not on an instance of the class. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24tests/auth_log: Call setUpClass() method of base classJoseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24tests/auth_log: Don’t silently override remoteAddressJoseph Sutton1-1/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24tests/auth_log_winbind: Expect an empty remote addressJoseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24tests/audit_log: Pre-compile GUID regexJoseph Sutton1-2/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24pyglue: Raise an exception on errorJoseph Sutton1-9/+9
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24pyglue: Check generate_random_str() return valueJoseph Sutton1-0/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-24pyglue: Fix typoJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-19gp: sshd policy correctly sort policyDavid Mulder1-5/+13
The sshd_config man page says that key value pairs 'the first obtained value will be used'. So we need to sort policies from last to first. 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 May 19 01:23:19 UTC 2023 on atb-devel-224
2023-05-18tests/krb5: Add tests presenting short-lived ticket in various scenariosJoseph Sutton1-0/+34
With the Heimdal KDC, we erroneously accept short-lived FAST and user-to-user tickets. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Rename modify_requester_sid_time() to modify_lifetime()Joseph Sutton2-7/+7
...now that the requester SID parameter is optional. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Change ‘sid’ parameter into optional ‘requester_sid’ ↵Joseph Sutton2-8/+9
parameter This is so callers can modify the lifetime of a ticket without necessarily changing the requester SID. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Use consistent time between get_KerberosTime() callsJoseph Sutton1-2/+4
Otherwise get_KerberosTime() calls time.time() itself, the value of which can change between calls. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Move modify_requester_sid_time() to RawKerberosTestJoseph Sutton2-79/+80
We shall make use of it in KdcTgsTests. Also move add_requester_sid(), which this function depends upon. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Set expected_status even if expect_status is not trueJoseph Sutton1-2/+3
We might get an NTSTATUS code even if we aren’t explicitly saying that we expect one. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Be less particular about getting NTSTATUS codes for KDC TGS testsJoseph Sutton1-2/+6
Samba currently doesn’t return a status code in these error cases. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Be less particular about expected status codes for S4U testsJoseph Sutton1-4/+63
Samba doesn’t return a status code for these error cases, so lower our expectations of getting them. We don’t have to add ‘'expect_status': None’ to all these test cases, but this makes it clear at a glance that ‘expected_status’ isn’t actually being checked, and gives us the opportunity to change this aspect of each individual test in the future. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Add tests for authentication policiesJoseph Sutton3-0/+6591
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Allow specifying whether PA-DATA types are to be checkedJoseph Sutton2-50/+61
Not all tests are intended to test that the correct PA-DATA types are returned. This parameter allows us to skip checking for cases where we don’t care. View with ‘git show -b’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Allow server and workstation accounts to perform a SamLogonJoseph Sutton1-0/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Allow specifying machine credentials to _test_samlogon()Joseph Sutton1-9/+11
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Rename ‘server’ to ‘dc_server’Joseph Sutton1-3/+3
This makes it more clear that this is in fact the DC. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Test that NT_STATUS_ACCOUNT_LOCKED_OUT is returned in KDC reply ↵Joseph Sutton1-24/+81
e-data Certain clients rely on this behaviour. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Improve edata checkingJoseph Sutton3-24/+71
Instead of guessing based on a heuristic whether we have KERB_ERROR_DATA or METHOD_DATA in the ‘e-data’ field, decode it first as KERB_ERROR_DATA and fall back to METHOD_DATA if that fails. The environment variable EXPECT_NT_STATUS indicates that the KDC supports returning a status code in the e-data field. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18tests/krb5: Remove unused importJoseph Sutton1-1/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18samba-tool domain: Clean up codeJoseph Sutton2-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-18samba-tool domain: Remove unused variablesJoseph Sutton4-33/+24
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-16samba-tool domain: Run in interactive mode if no args are suppliedJoseph Sutton1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15363 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-16python:tests: Remove unused variablesJoseph Sutton1-6/+6
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-16samba-tool domain: Remove unnecessary variableJoseph Sutton1-9/+9
It is conciser to use ‘r’ to refer to update_forest_info.entries[i]. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-16samba-tool domain: Use result of setup_local_server() instead of object fieldJoseph Sutton1-4/+4
The code is clearer if we consistently refer to the same variables. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-16pyglue: use Py_ssize_t in random data generation functionsDmitry Antipov1-21/+22
Prefer 'Py_ssize_t' over 'int' in random data generation functions to match both Python and (internally used through the library layer) GnuTLS APIs, and use PyUnicode_FromStringAndSize() where the data size is known. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> [abartlet@samba.org Fixed comments to correctly match the new check for just negative numbers]
2023-05-16samba-tool domain join: Allow "ad dc functional level" to change whichAndrew Bartlett1-2/+7
level we claim to be during an AD join Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-16samba-tool domain provision: Use "ad dc functional level" to control max ↵Joseph Sutton2-5/+7
functional level This allows the DC to self-declare a higher level and so allow a 2016 domain to be created, for testing and controlled implementation purposes. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-16python: Add function to get the functional level as a python intger from ↵Andrew Bartlett1-0/+21
smb.conf The lp.get() returns the normalised string from the enum handler Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-16samba-tool domain provision: Use common functional_level.string_to_level()Andrew Bartlett1-8/+5
This is instead of manually parsing the functional level strings. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-16python: Move helper functions for functional levels into a new fileAndrew Bartlett5-55/+78
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-09gp: get_gpo() should re-raise the Exception, not returnDavid Mulder1-1/+1
If we return from this failure, then `new_gpo` is set to `None` and we will fail in some obscure way within a CSE later (since we append `None` to the GPO list). Instead, re-raise the Exception so we see that an error happened when fetching the GPO. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-05tests/krb5: Improve _test_samr_change_password() methodJoseph Sutton2-17/+116
Instead of using anonymous credentials, we now connect using the passed-in credentials. We now correctly construct nt_password and nt_verifier so as to successfully change the password, instead of having to distinguish between a WRONG_PASSWORD error and an error caused by the password change being disallowed. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-05tests/krb5: Don’t delete silo until all tests have finishedJoseph Sutton1-2/+2
It’s possible that we reuse the same silo across multiple tests. In that case, we should not delete it until we are sure we have finished with it. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-05tests/krb5: Add remove_attribute() helper functionJoseph Sutton1-0/+8
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-05tests/krb5: Have set_forced_key() also set the NT hashJoseph Sutton1-1/+9
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-05tests/krb5: Make _tgs_req() more configurableJoseph Sutton1-8/+19
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>