summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2023-10-24python: netcmd: ntacl: fix import grouping and orderRob van der Linde1-13/+9
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-10-24python: add docstrings to Validator and ValidationErrorRob van der Linde1-0/+8
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-10-24python: move Validator base class and ValidationError to getoptRob van der Linde2-12/+13
It makes more sense for these to exist in the top package, because they are used by SambaOption. validators.py can still exist in netcmd, just not the base class and exception. 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-10-24python: getopt: move validators logic to parent classRob van der Linde2-17/+17
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-10-24netcmd: don't turn exception into CommandError in run_validatorsRob van der Linde2-85/+70
It's the wrong place to do it. Instead, let it raise the original exception, capture it in _run, and call existing show_command_error method. 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-10-24netcmd: PEP8: minor whitespace fix, file did not pass PEP8Rob van der Linde1-1/+1
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-10-24netcmd: move comment above class to docstringRob van der Linde1-3/+2
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-10-24netcmd: correctly pass Samba option class to OptionParserRob van der Linde1-1/+3
On OptionGroups it will set option_class and then this gets used by self.add_option 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-10-24python: getopt: move SambaOption to the top of the fileRob van der Linde1-45/+45
This is needed for the 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-10-24python: getopt: correctly group and sort importsRob van der Linde1-2/+3
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-10-24python: getopt: update super calls to python3 styleRob van der Linde1-5/+5
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-10-24python: move comment for check_bytes to docstringRob van der Linde1-4/+5
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-10-24python: PEP8 fixup whitespace in getopt.py firstRob van der Linde1-6/+6
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-10-24netcmd: tests: make check_run and related methods classmethod for consistencyRob van der Linde1-6/+9
Before that only run_command was turned into a @classmethod, but not the other related methods which were left unchanged, this made it inconsistent. Some of these methods need to be called from setUpTestData so they really need to be @classmethod anyway. 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-10-24tests: minor indentation and whitespace fixesRob van der Linde1-9/+11
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-10-24tests/krb5: Test whether the device belongs to some default groupsJoseph Sutton1-0/+183
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-24tests/krb5: Work around Samba’s incorrect krbtgt principal handlingJoseph Sutton2-5/+25
These tests fail only because they are using the ‘krbtgt@REALM’ form of the krbtgt principal that Samba doesn’t handle correctly. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-24tests/krb5: Remove unnecessary target_creds variablesJoseph Sutton1-21/+7
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Delete connection variableJoseph Sutton1-1/+1
This avoids a ‘variable set but unused’ warning. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Make ‘services’ parameter requiredJoseph Sutton1-1/+1
We use it unconditionally without a check for None. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Remove unreachable exception handlersJoseph Sutton1-9/+0
‘IOError’ is a subclass of ‘error’, which has already been handled. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Fix RC4‐only Protected Users testsJoseph Sutton1-0/+2
We forgot to actually use the ‘supported_enctypes’ parameter. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Remove unnecessary f‐stringsJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Remove unused importsJoseph Sutton2-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Fix DES3CBC random_to_key()Joseph Sutton1-1/+1
Because ‘keybytes’ is an immutable bytes object, ‘keybytes[7] = …’ has no hope of working. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Make ‘keybytes’ a bytes object rather than a listJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Don’t expect edata if no error is expectedJoseph Sutton1-6/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Add parameter to _tgs() specifying whether FAST is to be usedJoseph Sutton1-20/+30
View with ‘git show -b’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Use None for the default values of parametersJoseph Sutton1-2/+8
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Move assignments closer to where the variables are usedJoseph Sutton1-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Remove incorrect functional level checkJoseph Sutton1-5/+0
RBCD has no relevance to a method called _tgs(). Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Update method names to be consistent with other testsJoseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Have _modify_tgt() accept only keyword argumentsJoseph Sutton1-0/+1
to prevent further accidents. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Correctly pass arguments to _modify_tgt()Joseph Sutton1-3/+10
We were passing the new realm as the ‘renewable’ parameter! Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Add KDC_ERR_SERVER_NOMATCH error codeJoseph Sutton1-0/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Add ‘expect_edata’ parameter to _user2user()Joseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Fix commentJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-19tests/krb5: Remove markerJoseph Sutton1-2/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-17libcli/util: let win_errstr() fallback to hresult_errstr()Stefan Metzmacher1-1/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-17tests/krb5: Fix ASN.1 sourceJoseph Sutton1-1/+1
It currently fails to compile. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-17tests/krb5: Don’t expect groups if we’re expecting an errorJoseph Sutton1-12/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-17tests/krb5: Fix tests that crash WindowsJoseph Sutton1-28/+67
Expect an actual error code or an outcome, not CRASHES_WINDOWS. I don’t know which error codes Windows might be expected to produce, so I’ve chosen some that seem plausible. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-17tests/krb5: Expect a status code with policy errorsJoseph Sutton1-0/+9
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-17tests/krb5: Don’t consider RODC‐issued tickets to be banned with RBCDJoseph Sutton1-12/+3
If we’re verifying that a ticket was permitted to be issued by an RODC, and not trusting the group SIDs in the ticket, is there any reason to ban its use with RBCD? A client with a ticket issued by an RODC that happens to select a DC to direct an RBCD request at should not have the request mysteriously fail. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-16tests/krb5/kdc_tgs_tests: add user2user tests using a normal user accountStefan Metzmacher1-0/+36
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15492 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-16CVE-2018-14628: python:descriptor: let samba-tool dbcheck fix the ↵Stefan Metzmacher2-3/+22
nTSecurityDescriptor on CN=Deleted Objects containers BUG: https://bugzilla.samba.org/show_bug.cgi?id=13595 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-16CVE-2018-14628: dbchecker: use get_deletedobjects_descriptor for missing ↵Stefan Metzmacher1-3/+14
deleted objects container BUG: https://bugzilla.samba.org/show_bug.cgi?id=13595 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-16CVE-2018-14628: python:provision: make DELETEDOBJECTS_DESCRIPTOR available ↵Stefan Metzmacher2-0/+9
in the ldif files BUG: https://bugzilla.samba.org/show_bug.cgi?id=13595 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-16CVE-2018-14628: python:descriptor: add get_deletedobjects_descriptor()Stefan Metzmacher1-0/+10
samba-tool drs clone-dc-database was quite useful to find the true value of nTSecurityDescriptor of the CN=Delete Objects containers. Only the auto inherited SACL is available via a ldap search. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13595 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-16gpdupate: Implement Drive Maps Client Side ExtensionDavid Mulder2-2/+210
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>