summaryrefslogtreecommitdiff
path: root/selftest
Commit message (Collapse)AuthorAgeFilesLines
* selftest:clusteredmember: Build a unclist for every shareMartin Schwenke2020-02-191-0/+43
| | | | | | | | | | | | | | | This is fairly cheap and it is simple to do. This allows the Python code to be able to specify a unclist quite simply. The level of coupling doesn't seem worse than anything else in the selftest/autobuild code. There may be cleverer ways of doing this (e.g. a wrapper in testprogs/blackbox/clusteredmember_smbtorture or similar) but cleverer code isn't necessarily better code... and they'll probably involve code duplication. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* selftest:Samba3: add a clusteredmember environmentMichael Adam2020-02-192-0/+427
| | | | | | | | | | | Allow running tests against a CTDB setup, thereby covering the dbrwap_ctdb->ctdb stack in real SMB tests. Sets up a 3 node cluster. Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Martin Schwenke <martin@meltin.net>
* selftest: Split up a long lineVolker Lendecke2020-02-191-1/+6
| | | | | | | We'll add another argument soon Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* selftest: net command needs to think it is root in clustered caseMartin Schwenke2020-02-191-0/+1
| | | | | | | | | | | So just run it "as root" all the time. Something similar is already done for other things in Samba3::provision(), such as running smbpasswd in Samba3::createuser(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* selftest: Allow passing fork_and_exec()'s child_cleanupVolker Lendecke2020-02-191-3/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* selftest: Convert Samba3::check_or_start() to named parametersVolker Lendecke2020-02-191-13/+58
| | | | | | | Another parameter will be added soon. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* selftest: Parameterize clean up in the child processVolker Lendecke2020-02-191-5/+8
| | | | | | | Default to closing the write end of the parent->child pipe. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* selftest: Fix an uninitialised variable warning.Martin Schwenke2020-02-191-1/+1
| | | | | | | | | If $nmbd is not "yes" then this can result in a warning. Introduced in commit 676261fa08273114b888bb46f65de3de091b615b. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* selftest: Fix a warning messageVolker Lendecke2020-02-191-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* selftest: Add "share_dir" as an argument to Samba3::provision()Volker Lendecke2020-02-191-1/+1
| | | | | | | Default to the previous value Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* selftest: Allow "netbios name" to be overriden in Samba3::provision()Volker Lendecke2020-02-191-1/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* s3:tests: Add test for a dropbox with dir mode 0733Andreas Schneider2020-02-181-0/+9
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 18 21:07:44 UTC 2020 on sn-devel-184
* s3:tests: Add smbclient test for 'force create mode = 0664'Andreas Schneider2020-02-141-0/+8
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Feb 14 20:16:04 UTC 2020 on sn-devel-184
* s4-auth: Allow simple bind login of a user with an @ in the samAccountNameAndrew Bartlett2020-02-141-1/+0
| | | | | | | | | | | | | | | | LDAP Simple BIND authentications have already been mapped to a DOMAIN\username pair and should not be mapped twice. This appears to be a regression in 09e24ce40f89ac2f03d0c5fefa8b59f0d113fa6b included in Samba 4.7. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13598 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org> Autobuild-User(master): Isaac Boukris <iboukris@samba.org> Autobuild-Date(master): Fri Feb 14 17:13:33 UTC 2020 on sn-devel-184
* auth/credentials: Test connecting to LDAP with a "virtual user" style accountAndrew Bartlett2020-02-141-0/+1
| | | | | | | | | | | This type of account is often used by e-mail hosting platforms that do not wish to create an AD domain for each DNS domain that they host mail for. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13598 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org>
* libprc ndr tests: Fix ndrdump test ntlmssp_CHALLENGE_MESSAGEGary Lockyer2020-02-071-1/+0
| | | | | | | | | | | | | | | | Fix the expected data in fuzzed_ntlmssp-CHALLENGE_MESSAGE.txt, as it contained source code line numbers. Andrew this test needs to be altered to us a regular expression and remove the dependency on source line numbers. Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* librpc ndr: ndr_pull_advance check for unsigned overflow.Gary Lockyer2020-02-071-2/+1
| | | | | | | | | | | | Handle uint32 overflow in ndr_pull_advance Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* librpc ndr tests: Unsigned overflow in ndr_pull_advanceGary Lockyer2020-02-071-0/+1
| | | | | | | | | | | | Check that uint32 overflow is handled correctly by ndr_pull_advance. Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* librpc ndr: NDR_PULL_ALIGN check for unsigned overflowGary Lockyer2020-02-071-1/+0
| | | | | | | | | | | | Handle uint32 overflow in NDR_PULL_ALIGN Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* librpc ndr tests: uint32 overflow in NDR_PULL_ALIGNGary Lockyer2020-02-071-0/+1
| | | | | | | | | | | | Check that uint32 overflow is handled correctly by NDR_NEED_BYTES. Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* librpc ndr: Heap-buffer-overflow in lzxpress_decompressGary Lockyer2020-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reproducer for oss-fuzz Issue 20083 Project: samba Fuzzing Engine: libFuzzer Fuzz Target: fuzz_ndr_drsuapi_TYPE_OUT Job Type: libfuzzer_asan_samba Platform Id: linux Crash Type: Heap-buffer-overflow READ 1 Crash Address: 0x6040000002fd Crash State: lzxpress_decompress ndr_pull_compression_xpress_chunk ndr_pull_compression_start Sanitizer: address (ASAN) Recommended Security Severity: Medium Credit to OSS-Fuzz REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20083 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14236 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* source4/scripting/bin: Swap machine account password scriptsAndrew Bartlett2020-02-061-1/+1
| | | | | | | | | | | | | | | | | I regularly get requests for my simple script to print the password from the secrets.tdb (or secrets.ldb on the AD DC). This removes the old script that only reads the secrets.ldb. Neither new nor old script has tests, however it seems better to have it in the tree where it can be found rather that me digging it out of my outbound e-mail. Originally posted here: https://lists.samba.org/archive/samba/2017-November/212362.html Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* selftest: create a pcap file for the environment setupStefan Metzmacher2020-02-061-0/+3
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* selftest: create pcap files for invidual env servicesStefan Metzmacher2020-02-063-11/+15
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* selftest: move {setup,cleanup}_pcap() to selftest/target/Samba.pmStefan Metzmacher2020-02-062-34/+40
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* selftest: force LC_ALL=en_US.utf8 LANG=en_US.utf8Stefan Metzmacher2020-02-061-0/+2
| | | | | | | | That makes sure we have the same as on gitlab runners (see bootstrap/config.py). Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:auth_sam: map an empty domain or '.' to the local SAM nameStefan Metzmacher2020-02-051-1/+1
| | | | | | | | | | | | | When a domain member gets an empty domain name or '.', it should not forward the authentication to domain controllers of the primary domain. But we need to keep passing UPN account names with an empty domain to the DCs as a domain member. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14247 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3:selftest: test authentication with an empty userdomain and upn namesStefan Metzmacher2020-02-051-0/+7
| | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14247 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* selftest: simplify logic in setup_envDouglas Bagnall2020-02-041-8/+10
| | | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest: avoid comparison against undefined valueDouglas Bagnall2020-02-042-2/+6
| | | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/target/samba: do not look for undef environmentDouglas Bagnall2020-02-041-0/+3
| | | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/target/samba: add missing methodsDouglas Bagnall2020-02-041-0/+16
| | | | | | | | These methods are being called but have not been provided. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/s3: prefer empty string over undef to add nothing to configDouglas Bagnall2020-02-041-1/+1
| | | | | | | | To fix a warning. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/s3: actually close parent copy of smbd's STDINDouglas Bagnall2020-02-041-1/+1
| | | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/s4: remove illegal function signatureDouglas Bagnall2020-02-041-1/+1
| | | | | | | | | | | The character ':' has no meaning in function signatures. Perhaps ';' was intended, which would have marked the later arguments as optional -- which is the default with no signature. All callers always provide all the arguments anyway. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/s4: don't put pcap file in / by defaultDouglas Bagnall2020-02-041-1/+5
| | | | | | | | | If the SOCKET_WRAPPER_PCAP_DIR is not defined, let's assume it wasn't wanted rather than choosing /. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/s4: properly initialise an empty hashDouglas Bagnall2020-02-041-1/+1
| | | | | | | | | | | | | | The '%ret = {}' construction was bad because '{}' is a hash-ref, which counts as a single scalar value, but a true hash like '%ret' must be initialised with an even number of scalar values (usually in pairs, like '($a => $b, $c => $d)'). I think this meant %ret was initialised as something harmless like '(<HASH(0x55ce39781278)> => undef)'. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest: avoid redeclaring perl variablesDouglas Bagnall2020-02-043-17/+17
| | | | | | | | | None of these ones are doing any harm, we just want to silence these warnings. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest/target/samba: avoid overwriting $pkinitdirDouglas Bagnall2020-02-041-3/+3
| | | | | | | | | | We were declaring the same variable twice with two different paths, "$cadir/Users/$pkinitprincipalname" here and "$ctx->{prefix_abs}/pkinit" about 5 lines down. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest: enable perl warningsDouglas Bagnall2020-02-046-0/+6
| | | | | | | | | After this we will see more noise with each test run, and these warnings will be addressed in following commits. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4:torture: Convert samba4.base.charset test to smb2David Mulder2020-01-301-0/+2
| | | | | | | | | | | | | The partial surrogate test is known to fail (in both smb1 and smb2). Signed-off-by: David Mulder <dmulder@suse.com> Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Thu Jan 30 12:05:13 UTC 2020 on sn-devel-184
* selftest: Exit skipped daemons on close(STDIN)Volker Lendecke2020-01-291-1/+4
| | | | | | | | | | | Without this, teardown_env() will take ages for environments with skipped daemons Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jan 29 11:06:53 UTC 2020 on sn-devel-184
* selftest: Close STDIN_PIPE's write end for skipped daemonsVolker Lendecke2020-01-291-4/+5
| | | | | | | | | | Without this, any environment that skips any daemon will not shut down properly. If a copy of a pipe's write end remains, closing one of them won't cause the read end to be readable, i.e. the daemons waiting for that won't exit properly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest: Convert Samba3::provision() to named parametersVolker Lendecke2020-01-271-57/+86
| | | | | | | 9 positional parameters is a bit too much for easy overview Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* selftest: Factor out create_file_chmod()Volker Lendecke2020-01-271-48/+24
| | | | | | | 24 lines less perl :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* selftest: Make 'Samba Users' the primary group of joeAndreas Schneider2020-01-241-0/+28
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
* selftest: Add a group 'Samba Users'Andreas Schneider2020-01-241-0/+15
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
* selftest: Add user joeAndreas Schneider2020-01-241-1/+1
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
* testenv: No "mktemp" for in_screenVolker Lendecke2020-01-211-6/+0
| | | | | | We don't use this Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* testenv: Simplify "in_screen"Volker Lendecke2020-01-211-9/+1
| | | | | | We don't need "seq", bash can do that itself, and we assume bash here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>