summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2025-01-07tests: use clean_file() from our superclass in smb3unix.pyRalph Boehme1-14/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15751 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-02testparm: do not fail if /run/samba does not existMichael Tokarev1-4/+2
testparm explicitly fails if $piddir or $lockdir does not exist. However, the daemons which actually use these directories, will create it on demand, there is no need to fail even simple testparm operations if the dirs are not there. This change lets to (pre)configure samba without bothering to pre-create the directories which are overwise needed only to fulfil testparm criteria. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2024-12-20pytest: password_hash uses internal _glue.cryptDouglas Bagnall1-2/+2
This will remove an external dependency. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-20samba-tool user: hashlib.sha1 is always presentDouglas Bagnall1-12/+4
We maybe thought we were checking that sha1 was in hashlib, but we were only checking that hashlib is in the Python library (`hashlib.sha1()` would not raise ImportError). The documentation says hashlib always contains sha1 -- if that changes, it is better we know by failing noisily with the import error at the top of the file. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-20samba-tool user: use _glue.crypt, not crypt.cryptDouglas Bagnall1-15/+6
Because we know we have _glue.crypt, and we know it raises exceptions rather than returning None, we can simplify the checks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-20pytest: test that _glue.crypt worksDouglas Bagnall1-0/+65
The test vectors were generated via Python 3.10 crypt module, which directly wraps crypt(3), which in this case is from glibc 2.39-0ubuntu8.3. We mainly test the sha256 and sha512 vectors, which seems to be all we use, and which are said to be widely supported. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-20pyglue: add crypt() functionDouglas Bagnall2-0/+42
This wraps talloc_crypt_blob() from lib/util/util_crypt.c which in turn wraps the system crypt[_r[n]]. We want this because the Python standard library crypt module is going away. That one also wrapped the system crypt or crypt_r, so there should be no change. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-20samba-tool: no traceback for unauthenticated rootdse accessDouglas Bagnall1-0/+3
Under some circumstances rootdse returns an operations error with "Operation unavailable without authentication" instead of insufficient access rights. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Fri Dec 20 00:00:02 UTC 2024 on atb-devel-224
2024-12-12python:tests/krb5: add ServerAuthenticateKerberos related tests to netlogon.pyStefan Metzmacher1-4/+468
Works against Windows 2025 preview: SMB_CONF_PATH=/dev/null \ SERVER=172.31.9.115 DC_SERVER=w2025p-115.w2025p-l8.base \ DOMAIN="W2025P-L8" REALM="W2025P-L8.BASE" \ ADMIN_USERNAME="Administrator" ADMIN_PASSWORD="A1b2C3d4" \ NETLOGON_STRONG_KEY_SUPPORT=1 NETLOGON_AUTH_KRB5_SUPPORT=1 \ STRICT_CHECKING=0 python/samba/tests/krb5/netlogon.py The code still works against Windows 2022 with the following options: SMB_CONF_PATH=/dev/null \ SERVER=172.31.9.118 DC_SERVER=w2022-118.w2022-l7.base \ DOMAIN="W2022-L7" REALM="W2022-L7.BASE" \ ADMIN_USERNAME="Administrator" ADMIN_PASSWORD="A1b2C3d4" \ NETLOGON_STRONG_KEY_SUPPORT=1 NETLOGON_AUTH_KRB5_SUPPORT=0 \ STRICT_CHECKING=0 python/samba/tests/krb5/netlogon.py Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-12python:tests/krb5: let netlogon.py test strong key without arcfourStefan Metzmacher1-1/+13
It shows that there's no encryption on buffers... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-10samba-tool/backup: set the right permissions on our root dirBjörn Jacke1-0/+2
Since processes can run under the UID of the logged in user, it's required to make sure that the users have the permissions here. Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Björn Baumbach <bbaumbach@samba.org> Autobuild-User(master): Björn Baumbach <bb@sernet.de> Autobuild-Date(master): Tue Dec 10 11:40:27 UTC 2024 on atb-devel-224
2024-12-05python:tests/krb5: add netlogon.pyStefan Metzmacher1-0/+1483
This adds tests for the application layer encryption used based on the secure channel session key. This will get tests for netr_ServerAuthenticateKerberos() in order to explore its details. This runs against Windows 2022 as well as Windows 2025 (preview) using something like this: SMB_CONF_PATH=/dev/null \ SERVER=172.31.9.118 DC_SERVER=w2022-118.w2022-l7.base \ DOMAIN="W2022-L7" REALM="W2022-L7.BASE" \ ADMIN_USERNAME="Administrator" ADMIN_PASSWORD="A1b2C3d4" \ STRICT_CHECKING=0 \python/samba/tests/krb5/netlogon.py Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-05python:tests/krb5: avoid some problems when running against w2025 (preview) ↵Stefan Metzmacher1-2/+3
with STRICT_CHECKING=0 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-05python:tests/krb5: remember the objectGUID of created accountsStefan Metzmacher2-1/+14
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-05tests/krb5: make use of conn.auth_info() in _test_samlogon()Stefan Metzmacher1-2/+1
In future we'll have KRB5 instead of SCHANNEL... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-05python/ndr: allow print_secrets=True for ndr_print*Stefan Metzmacher1-6/+6
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-11-27tests: test POSIX file type on reparse pointRalph Boehme1-0/+28
Create a symlink reparse point over SMB2. Then query file info over SMB2 and check the POSIX file type is correctly assigned in the POSIX info levels. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27tests: check reparse tag and POSIX file type from query-file with POSIX ↵Ralph Boehme1-3/+11
infolevel Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27tests: fix test teardown/cleanup of test_create_reparse_directory()Ralph Boehme1-1/+5
This kept failing in a local make test not being able to cleanup the test directory in the *subsequent* test test_create_reparse_nonempty_directory(). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27tests: prepare reparsepoints.py for using POSIX on the SMB2 connectionRalph Boehme1-1/+5
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27tests: move wire_mode_to_unix() to libsmb.pyRalph Boehme2-7/+8
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27python: Fix length of Common Name x509 attributeAndreas Schneider1-2/+1
File "bin/python/samba/tests/krb5/pkinit_tests.py", line 1496, in create_certificate x509.NameAttribute(NameOID.COMMON_NAME, ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ f'{cert_name}/emailAddress={cert_name}'), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.13/site-packages/cryptography/x509/name.py", line 152, in __init__ raise ValueError(msg) ValueError: Attribute's length must be >= 1 and <= 64, but it was 84 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-11-22tests: Check symlinks are readable as reparse pointsVolker Lendecke1-12/+29
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Fri Nov 22 11:05:33 UTC 2024 on atb-devel-224
2024-11-22tests: Fix test_symlinkerror_absolute_inshareVolker Lendecke1-1/+1
This tests converting an absolute into a relative target. Reflect that in the flags expected from the STOPPED_ON_SYMLINK error response. As of this patch it's still knownfail, so irrelevant. But soon this test will succeed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-22tests: Reparse point dirs are shown as REPARSE_POINT|DIRECTORYVolker Lendecke1-0/+9
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-22tests: Reparse point files are shown as FILE_ATTRIBUTE_REPARSE_POINTVolker Lendecke1-0/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-19tests: Use unix_mode_to_wire() in smb3unix testsVolker Lendecke1-2/+8
Also add the file type. Not really relevant in create, IMHO it looks nicer in the code. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-06pytest: s/the the\b/the/ in commentsDouglas Bagnall2-2/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-06samba-tool:: s/the the\b/the/ in docstringDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-10-31netcmd: More explicit warning when python-gpg is missingAndréas Leroux1-1/+5
Signed-off-by: Andréas Leroux <aleroux@tranquil.it> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Thu Oct 31 00:23:09 UTC 2024 on atb-devel-224
2024-10-30python/tests: use encrypt_netr_PasswordInfo in KDCBaseTest._test_samlogon()Stefan Metzmacher1-2/+8
This will make it easier to implement netr_ServerAuthenticateKerberos() later... BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-10-23Fix usage test broken by rust vendor sourcesDavid Mulder1-0/+2
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-10-23Add pyglue for Rust for disabling testsDavid Mulder3-0/+17
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-10-23Improve cargo test outputDavid Mulder1-3/+13
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-10-23Enable rust cargo test in Samba make testDavid Mulder1-0/+67
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-10-14tests: add test for cli_get_posix_fs_infoJule Anger1-0/+20
Signed-off-by: Jule Anger <janger@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Oct 14 08:48:07 UTC 2024 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-10-04netcmd:domain:policy: Fix missing conversion from tgt_lifetime minutes to ↵Andréas Leroux2-12/+25
10^(-7) seconds BUG: https://bugzilla.samba.org/show_bug.cgi?id=15692 Signed-off-by: Andréas Leroux <aleroux@tranquil.it> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Fri Oct 4 04:01:22 UTC 2024 on atb-devel-224
2024-09-26pylibsmb: Fix a typoVolker Lendecke1-1/+1
pylibsmb is supposed to be used only internally, at least I hope this has not made it into an API that is perceived to be publically used. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Sep 26 16:35:55 UTC 2024 on atb-devel-224
2024-09-26tests: Check that we return the posix type in query_directoryVolker Lendecke1-3/+14
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>