summaryrefslogtreecommitdiff
path: root/selftest
Commit message (Collapse)AuthorAgeFilesLines
* s4:torture/smb2: add smb2.samba3misc.localposixlock1Stefan Metzmacher2019-09-092-0/+2
| | | | | | | | | | | This demonstrates that the SMB2 code path doesn't do any retry for local posix locks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 7155d3a2c5d7237f00cccb1802c1341cf295864e)
* s3:blocking: maintain state->deny_statusStefan Metzmacher2019-09-091-1/+0
| | | | | | | | | | | For Windows locks we start with LOCK_NOT_GRANTED and use FILE_LOCK_CONFLICT if we retried after a timeout. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit aba0ee46258f3dd910421facb742fce3318a6946)
* s4:torture/raw: assert to get LOCK_NOT_GRANTED in ↵Stefan Metzmacher2019-09-091-0/+1
| | | | | | | | | | | | | torture_samba3_posixtimedlock() There should not be a different if the blocker is a posix process instead of another smbd. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 2a77025a1e16d897281e5840192c93fa03328681)
* s3:blocking: fix posix lock retryStefan Metzmacher2019-09-091-1/+0
| | | | | | | | | | | | | | | We should evaluate the timeout condition after the very last retry and not before. Otherwise we'd fail to retry when waiting for posix locks. The problem happens if the client provided timeout is smaller than the 1 sec (for testing temporary 15 secs) retry. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit e8d719d31f885d7b6d5b317165f90ec40df169c9)
* s3:blocking: demonstrate the posix lock retry failsStefan Metzmacher2019-09-091-0/+1
| | | | | | | | | | | | | | This is just a temporary commit that shows the bug and its fix. It will be reverted once the problem is fixed. The posix lock retry fails if the client specified timeout is smaller than the hardcoded 1 second retry. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 2ec9e93a7aac2706b4a5931495d56a7b64f8d894)
* s3:torture: convert LOCK9 into LOCK9A and LOCK9BStefan Metzmacher2019-09-091-1/+1
| | | | | | | | | | | | | | LOCK9A is the original test (with a timeout of -1) and LOCK9B is the same but with timeout of 10 seconds. LOCK9B is needed to demonstrate a server bug in the next commits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit ac28eec3e4af710feab3be3d4b25bfbe38294431)
* CVE-2019-10197: smbd: split change_to_user_impersonate() out of ↵Stefan Metzmacher2019-09-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | change_to_user_internal() This makes sure we always call chdir_current_service() even when we still impersonated the user. Which is important in order to run the SMB* request within the correct working directory and only if the user has permissions to enter that directory. It makes sure we always update conn->lastused_count in chdir_current_service() for each request. Note that vfs_ChDir() (called from chdir_current_service()) maintains its own cache and avoids calling SMB_VFS_CHDIR() if possible. It means we still avoid syscalls if we get a multiple requests for the same session/tcon tuple. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* CVE-2019-10197: test_smbclient_s3.sh: add regression test for the no ↵Stefan Metzmacher2019-09-032-0/+13
| | | | | | | | permission on share root problem BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* CVE-2019-10197: selftest: make fsrvp_share its own independent subdirectoryStefan Metzmacher2019-09-031-2/+5
| | | | | | | | The next patch will otherwise break the fsrvp related tests. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* downgradedatabase: installing scriptAaron Haslett2019-08-261-1/+0
| | | | | | | | | | | | | | | Installing downgrade script so people don't need the source tree for it. Exception added in usage test because running the script without arguments is valid. (This avoids the need to knownfail it). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> (cherry picked from commit 6dcf00ba0a470ba25aabae06b409ec95404c246f)
* downgradedatabase: rename to samba_downgrade_dbTim Beale2019-08-261-1/+1
| | | | | | | | | | | Just so that it's slightly less of a mouthful for users. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> (cherry picked from commit fdaaee8d3aac77d91642a7d75d4bcd15d4df8657)
* selftest: explicitly set "mangled names = yes"Ralph Boehme2019-07-082-0/+2
| | | | | | | | | This is the current default and what 'make test' assumes currently. The next commit will change the default to "illegal". Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* selftest: explicitly set "client min protocol = CORE"Stefan Metzmacher2019-07-083-0/+3
| | | | | | | | | This is the current default and what 'make test' assumes currently. The next commit will change the default to disable SMB1. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* selftest: explicitly set "server min protocol = LANMAN1"Stefan Metzmacher2019-07-082-0/+3
| | | | | | | | | This is the current default and what 'make test' assumes currently. The next commit will change the default to disable SMB1. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* smbtorture: Add smb2.ioctl.zero_dataChristof Schmitt2019-07-051-0/+2
| | | | | | | | Allow to manually issue the FSCTL_ZERO_DATA call and verify the state of the file in the file system. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* smbtorture: Add smb2.ioctl.sparse_set_sparseChristof Schmitt2019-07-051-0/+2
| | | | | | | | This allows for manual testing of changing the sparse setting on a file and verifying the flag in the file system. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/torture: remove autoidlDouglas Bagnall2019-07-051-1/+0
| | | | | | | | | This has been turned off by default for 10 years (since 26e114b83ce1de7515bfbf365), and is only interesting for nostalgia purposes. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/scripting/autoidl: remove itDouglas Bagnall2019-07-051-1/+0
| | | | | | | | | | | | | What does it even do? Possibly nothing, not least because nobody ever runs it. It was introduced as source4/scripting/bin/autoidl.py in a2446e5f8550582c0d4353bb85874dea17cf1d98 ("initial work for script that uses probing to figure out IDL"). Since then it has only had superficial patches, generally aimed at Python 3. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/usage: test for --help consistencyDouglas Bagnall2019-07-051-0/+7
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/usage: generalise to cover non-python scriptsDouglas Bagnall2019-07-051-0/+1
| | | | | | | | It is not as simple as running everything executable, because for example .so library files are marked as executable. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/usage: python scripts --help should be helpfulDouglas Bagnall2019-07-051-0/+14
| | | | | | | We want to be sure it says *something* and returns success. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/scripting/samba_dnsupdate: print usage with no argumentsDouglas Bagnall2019-07-051-2/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/scripting/demodirsync: print usage if no host namedDouglas Bagnall2019-07-051-1/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/scripting/mymachinepw: print usage with bad argumentsDouglas Bagnall2019-07-051-1/+0
| | | | | | | | Also, use sys.exit() function, not exit(), because sys.exit() reliably exists. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/scripting/get-descriptors: print usage with insufficient argumentsDouglas Bagnall2019-07-051-1/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* script/compare_cc_results: print usage on too few argsDouglas Bagnall2019-07-051-1/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dns_hub: print usage with too few argsDouglas Bagnall2019-07-052-1/+4
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests: ensure that most python scripts have usage textDouglas Bagnall2019-07-051-0/+28
| | | | | | | | | | | | | | | | | | | | | When a script is run with the wrong arguments, it should at least say something like this: Usage: samba-foo [OPTIONS] For many samba scripts, especially without a server environment, having no arguments is the wrong arguments. Here we look for every executable file with '#![...]python[3]' on the first line, and exclude certain files and directories that have excuses to fail the test. For example, many selftest scripts are stream-oriented and will hang forever waiting for stdin, which is not an error. Some test modules are designed so they can be optionally run from the command line, but this option is typically only used by the developer who is writing them. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool user edit: avoid base64 encoded strings in editable ldif if possibleBjörn Baumbach2019-07-041-1/+0
| | | | | | | | | | | Use clear text arguments strings if possible. Makes it more comfortable for users to edit the user objects attributes. Remove test from knownfail: samba.tests.samba_tool.user_edit.change_attribute_force_no_base64 Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool tests: add test for 'samba-tool user edit', using ↵Björn Baumbach2019-07-041-0/+1
| | | | | | | | | LDB_FLAG_FORCE_NO_BASE64_LDIF Test to edit a user: Change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool user edit: use ldb methods to create ldif to modify userBjörn Baumbach2019-07-041-3/+0
| | | | | | | | | | | | Remove tests from knownfail: samba.tests.samba_tool.user_edit.add_attribute_base64 samba.tests.samba_tool.user_edit.add_attribute_base64_control samba.tests.samba_tool.user_edit.change_attribute_base64_control BUG: https://bugzilla.samba.org/show_bug.cgi?id=14003 Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool tests: add additional tests for "samba-tool user edit" commandBjörn Baumbach2019-07-041-0/+3
| | | | | | | | | | | | | | Especially test handling of base64 encoded attribute values here. Add selftest/knownfail.d/samba_tool.user_edit. Tests fail, because: - can not work with ldif without a trailing new line - can not handle base64 strings BUG: https://bugzilla.samba.org/show_bug.cgi?id=14003 Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Add PrimaryGroupId to group array in DC responseIsaac Boukris2019-07-031-1/+0
| | | | | | | | | | | | | | | | This is a simplified version of the original patch by: Felix Botner <botner@univention.de> BUG: https://bugzilla.samba.org/show_bug.cgi?id=11362 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Isaac Boukris <iboukris@gmail.com> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Jul 3 13:52:55 UTC 2019 on sn-devel-184
* selftest: check for PrimaryGroupId in DC returned group arrayIsaac Boukris2019-07-031-0/+1
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11362 Signed-off-by: Isaac Boukris <iboukris@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* repl_md: Avoid dropping cross-partition linksTim Beale2019-07-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Cross-partition links could still be dropped if GET_TGT was already previously set for the replication. This was due to a slight error in the order of logic. We never want to ignore cross-partition links (regardless of whether the TARGETS_UPTODATE /GET_TGT flag is set). We should only be returning early in the GET_TGT case if the objects are both in the same partition. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14022 RN: When the AD domain contained a linked attribute that spanned partitions, DRS replication could drop the link. This dropped link could then result in subtle differences in behaviour between DCs, as some DCs would have the link and others wouldn't. When this issue occurred, the dropped link would be logged in a warning message: "<target-dn> is Unknown but up to date. Ignoring link from <source-dn>" This issue would not always occur - it depended a lot on the database contents. Typically, it would only potentially occur when joining a new DC to the domain (doing an ldapcmp after the join would also highlight the problem, if it occurred). This issue has now been resolved. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests: Add getncchanges test for cross-partition links + TGTTim Beale2019-07-021-0/+2
| | | | | | | | | | | | | | | | | | | This adds a test-case to highlight a bug in the client side GetNCChanges handling. These tests mostly exercise the server-side behaviour of sending the GetNCChanges, however, there's a bug in the client-side code when we try to handle a missing cross-partition link target *in combination* with the GET_TGT flag already having been set. The test is exercising the client-side code by using the 'samba-tool drs replicate' command. By adding a one-way link to a deleted target object, we force the client code to retry with the GET_TGT flag set. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14022 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool domain join: remove the subdomain optionGary Lockyer2019-07-021-103/+0
| | | | | | | Remove the sub domain option from join, as it currently does not work. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool domain dcpromo: add --backend-store-size optionGary Lockyer2019-07-021-1/+0
| | | | | | | | | Add a new "samba-tool domain dcpromo" option "backend-store-size". This allows the lmdb map size to be set during a promotion, instead of hard-wiring it to 8Gb. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool dcpromo tests: add --backend-store-size optionGary Lockyer2019-07-021-0/+1
| | | | | | | | | Add a new "samba-tool domain dcpromo" option "backend-store-size". This allows the lmdb map size to be set during a promotion, instead of hard-wiring it to 8Gb. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool clone-dc-database: Add --backend-store-size optionGary Lockyer2019-07-021-5/+0
| | | | | | | | | Add a new "samba-tool drs clone-dc-database" option "backend-store-size". This allows the lmdb map size to be set during a clone, instead of hard-wiring it to 8Gb. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>' Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* clone-dc-database tests: Add --backend-store-size optionGary Lockyer2019-07-021-0/+5
| | | | | | | | | Add a new "samba-tool drs clone-dc-database" option "backend-store-size". This allows the lmdb map size to be set during a clone, instead of hard-wiring it to 8Gb. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>' Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool domain join: Add --backend-store-size optionGary Lockyer2019-07-021-3/+0
| | | | | | | | | Add a new "samba-tool domain join" option "backend-store-size". This allows the lmdb map size to be set during a provision, instead of hard-wiring it to 8Gb. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* domain join tests: Add --backend-store-size option.Gary Lockyer2019-07-021-0/+3
| | | | | | | | | Tests for the new "samba-tool domain join" option "backend-store-size". This allows the lmdb map size to be set during a provision, instead of hard-wiring it to 8Gb. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* provision: Add --backend-store-size optionGary Lockyer2019-07-021-4/+0
| | | | | | | | | Add a new "samba-tool domain provision" option "backend-store-size". This allows the lmdb map size to be set during a provision, instead of hard-wiring it to 8Gb Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib ldb ldb_mdb: Pass the lmdb map size as an ldb optionGary Lockyer2019-07-021-0/+1
| | | | | | | | Allow the lmdb map size to be specified in the ldb option "lmdb_env_size". Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool domain provision: add lmdb database size optionGary Lockyer2019-07-021-4/+0
| | | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* provision tests: Add --backend-store-size option.Gary Lockyer2019-07-021-0/+7
| | | | | | | | | Tests for the new "samba-tool domain provision" option "backend-store-size". This allows the lmdb map size to be set during a provision, instead of hard-wiring it to 8Gb Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest: add a test that itime is not set when setting DOS attrsRalph Boehme2019-07-011-0/+5
| | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jul 1 23:21:07 UTC 2019 on sn-devel-184
* vfs_fruit: make "fruit:zero_file_id" a per share optionRalph Boehme2019-07-011-0/+7
| | | | | | | | Now that File-ID calculation goes through the VFS, we can nicely make a per-share option out of it. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: torture: Ensure we can always get a POSIX ACL on a directory handle.Jeremy Allison2019-06-261-0/+1
| | | | | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jun 26 19:31:28 UTC 2019 on sn-devel-184