summaryrefslogtreecommitdiff
path: root/python/samba/tests/dcerpc
AgeCommit message (Collapse)AuthorFilesLines
2025-10-10mdssvc: implement elasticsearch:default_fieldsRalph Boehme1-3/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15927 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-10-10mdssvc: fix filtering by share path prefixRalph Boehme1-6/+45
To correctly filter by share path, use a filter with a prefix match. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15927 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-08-15CI: add Python test samba.tests.dcerpc.dfs.DfsTests.test_dfs_reparse_tagRalph Boehme1-0/+48
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15843 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-02-17python:lsa_utils: Fix fallback to OpenPolicy2Stefan Metzmacher1-16/+29
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680 Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Feb 17 18:33:15 UTC 2025 on atb-devel-224
2025-02-17python:lsa_utils: Don't use optional arguments for OpenPolicyFallback()Andreas Schneider1-2/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-02-08python:tests: let lsa_utils.py use valid netbios namesStefan Metzmacher1-2/+2
createtrustrelax has 16 characters, but only 15 are allowed and they are typically uppercase. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-01-29python:tests/dcerpc/lsa: add tests for invalid LookupSids2 combinationsStefan Metzmacher1-2/+224
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-24s3/mdssvc: add option "elasticsearch:force_substring_search = yes | no" ↵Ralph Boehme1-0/+34
(default: no) Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Jan 24 10:52:33 UTC 2025 on atb-devel-224
2024-10-10tests/dcerpc/raw_protocol: test invalid schannel bindsStefan Metzmacher1-0/+152
Note the ad_member will keep these as expected failures, as it doesn't provide the netlogon service, while the knownfail for the ADDC is only temporary. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: add more tests for auth_pad alignmentStefan Metzmacher1-2/+17
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: add tests for max auth_padding, auth_len or ↵Stefan Metzmacher1-0/+537
auth_offset BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: fix comment in test_spnego_change_auth_type1Stefan Metzmacher1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: test_no_auth_ctx_requestStefan Metzmacher1-0/+33
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: run test_neg_xmit_ffff_ffff over tcp and smbStefan Metzmacher1-5/+23
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10RawDCERPCTest: add some more auth_length related assertsStefan Metzmacher1-3/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10RawDCERPCTest: split prepare_pdu() and send_pdu_blob() out of send_pdu()Stefan Metzmacher1-8/+19
This will make it possible to alter pdus before sending them to the server. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: add more test for auth padding during ↵Stefan Metzmacher1-3/+369
ALTER_CONTEXT/AUTH3 The aim is to keep testing the code paths, which are no longer testing because allow_bind_auth_pad is false now, which means the existing tests fail directly at the BIND, but we also want to test the error handling on ALTER_CONTEXT (and AUTH3). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10tests/dcerpc/raw_protocol: pass against Windows 2022 and require special env ↵Stefan Metzmacher2-18/+196
vars for legacy servers Test works against Windows 2022 and works like this: SMB_CONF_PATH=/dev/null SERVER=172.31.9.118 \ TARGET_HOSTNAME=w2022-118.w2022-l7.base IGNORE_RANDOM_PAD=1 \ DOMAIN=W2022-L7 REALM=W2022-L7.BASE \ USERNAME=administrator PASSWORD=A1b2C3d4 \ python/samba/tests/dcerpc/raw_protocol.py -v -f TestDCERPC_BIND Against a legacy Windows2012R2 server this still works: SMB_CONF_PATH=/dev/null SERVER=172.31.9.188 \ TARGET_HOSTNAME=w2012r2-188.w2012r2-l6.base ALLOW_BIND_AUTH_PAD=1 \ LEGACY_BIND_NACK_NO_REASON=1 AUTH_LEVEL_CONNECT_LSA=1 \ IGNORE_RANDOM_PAD=1 DOMAIN=W2012R2-L6 REALM=W2012R2-L6.BASE \ USERNAME=administrator PASSWORD=A1b2C3d4 \ python/samba/tests/dcerpc/raw_protocol.py -v -f TestDCERPC_BIND Currently Samba behaves like 2012R2, but the next commits will change that... BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-10-10RawDCERPCTest: ignore errors in smb_pipe_socket.close()Stefan Metzmacher1-1/+11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-06-12pytest: remove py2 str/bytes workaround in samr_change_passwordDouglas Bagnall1-1/+1
It is likely not necessary to cast to list(). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-06-12pytest: remove py2 str/bytes workaround in lsa_utilsDouglas Bagnall1-6/+2
It is likely not necessary to cast to list() in most cases. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09python: Implement CreateTrustedDomainFallback()Andreas Schneider1-1/+97
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09python:tests: Clean lsa_utils.py code according to Python standardsAndreas Schneider1-12/+26
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09python:tests: Rename createtrustrelax.py to lsa_utils.pyAndreas Schneider1-0/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09python: Implement OpenPolicyFallback()Andreas Schneider1-7/+15
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-04-09python:samba: Rename trust_utils.py to lsa_utils.pyAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-12-08tests/dcerpc: Remove unused importsJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-12-08tests/dcerpc: Correct docstringJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-30python: Correct Python2 super() calls that called the wrong classAndrew Bartlett2-2/+2
These changes have been checked as safe as skipping a superclass has no actual impact. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-11-30python: tests: update all super calls to python 3 style in testsRob van der Linde12-16/+16
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> [abartlet@samba.org Some python2 style super() calls remain due to being an actual, even if reasonable, behaviour change]
2023-11-30python: get rid of pointless empty overridden methodsRob van der Linde2-4/+0
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-11-30python: PEP275: docstrings should always use double quotesRob van der Linde2-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-08-30python: Remove unused importsJoseph Sutton1-1/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-26mdssvc: reduce pagesize to 50Ralph Boehme1-2/+2
Lastest macOS queries additional file metadata per search result, which causes the mashalled paged result set including metadata to exceed the 64 KB result fragment buffer. Lacking fragementation support in mdssvc (it's supported by the protocol), for now just reduce the maximum number of results per search page. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15342 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-07-26tests/mdssvc: match hits:total:value to be the actual amount of entries in hitsRalph Boehme1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15342 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-07-21CVE-2023-34968: mdscli: return share relative pathsRalph Boehme1-13/+13
The next commit will change the Samba Spotlight server to return absolute paths that start with the sharename as "/SHARENAME/..." followed by the share path relative appended. So given a share [spotlight] path = /foo/bar spotlight = yes and a file inside this share with a full path of /foo/bar/dir/file previously a search that matched this file would returns the absolute server-side pato of the file, ie /foo/bar/dir/file This will be change to /spotlight/dir/file As currently the mdscli library and hence the mdsearch tool print out these paths returned from the server, we have to change the output to accomodate these fake paths. The only way to do this sensibly is by makeing the paths relative to the containing share, so just dir/file in the example above. The client learns about the share root path prefix – real server-side of fake in the future – in an initial handshake in the "share_path" out argument of the mdssvc_open() RPC call, so the client can use this path to convert the absolute path to relative. There is however an additional twist: the macOS Spotlight server prefixes this absolute path with another prefix, typically "/System/Volumes/Data", so in the example above the full path for the same search would be /System/Volumes/Data/foo/bar/dir/file So macOS does return the full server-side path too, just prefixed with an additional path. This path prefixed can be queried by the client in the mdssvc_cmd() RPC call with an Spotlight command of "fetchPropertiesForContext:" and the path is returned in a dictionary with key "kMDSStorePathScopes". Samba just returns "/" for this. Currently the mdscli library doesn't issue this Spotlight RPC request (fetchPropertiesForContext), so this is added in this commit. In the end, all search result paths are stripped of the combined prefix kMDSStorePathScopes + share_path (from mdssvc_open). eg kMDSStorePathScopes = /System/Volumes/Data share_path = /foo/bar search result = /System/Volumes/Data/foo/bar/dir/file relative path returned by mdscli = dir/file Makes sense? :) BUG: https://bugzilla.samba.org/show_bug.cgi?id=15388 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-06-23python:samba:tests: Fix code spellingAndreas Schneider3-3/+3
Signed-off-by: Andreas Schneider <asn@samba.org> 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-02-23python: fix mutable default argumentsRob van der Linde1-4/+12
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-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): Thu Feb 23 23:33:46 UTC 2023 on atb-devel-224
2021-11-09CVE-2021-23192: python/tests/dcerpc: add tests to check how security ↵Stefan Metzmacher1-0/+1273
contexts relate to fragmented requests BUG: https://bugzilla.samba.org/show_bug.cgi?id=14875 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-11-09CVE-2021-23192: python/tests/dcerpc: fix do_single_request(send_req=False)Stefan Metzmacher1-17/+20
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14875 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-11-09CVE-2021-23192: python/tests/dcerpc: let generate_request_auth() use ↵Stefan Metzmacher1-3/+3
g_auth_level in all places BUG: https://bugzilla.samba.org/show_bug.cgi?id=14875 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-11-09CVE-2021-23192: python/tests/dcerpc: change assertNotEquals() into ↵Stefan Metzmacher2-151/+151
assertNotEqual() BUG: https://bugzilla.samba.org/show_bug.cgi?id=14875 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2021-09-05selftest: Add a test for LookupSids3 and LookupNames4 in pythonAndrew Bartlett1-0/+333
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14807 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-06-22pytest: dcerpc/dnsserver: fix tombstone testDouglas Bagnall1-12/+80
It worked accidentally, like all our tombstone tests. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-28python: remove all 'from __future__ import print_function'Douglas Bagnall2-2/+0
This made Python 2's print behave like Python 3's print(). In some cases, where we had: from __future__ import print_function """Intended module documentation...""" this will have the side effect of making the intended module documentation work as the actual module documentation (i.e. becoming __doc__), because it is once again the first statement in the module. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-08pytest/dcerpc/dnsserver.py: use dnsserver.flag_from_stringDouglas Bagnall1-9/+6
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2021-04-08pytest/dcerpcdnsserver: use record_from_string helperDouglas Bagnall1-28/+3
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2021-03-29pytest/dnsserver: extend record_type_int to all typesDouglas Bagnall1-17/+2
with improved diagnostics on bad arguments Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>