1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-04 05:18:06 +03:00
Commit Graph

76 Commits

Author SHA1 Message Date
Uri Simchoni
2bf01b286c s4-torture: fix type of enum in various places
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-11-24 01:13:15 +01:00
Ralph Boehme
492930779a s4/torture: test fetching a resume key twice
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-03 19:59:08 +02:00
Ralph Boehme
2b3fcc56e6 s4/torture: more tests for copy-chunk across shares
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-03 19:59:08 +02:00
Ralph Boehme
d50f307e97 s4/torture: add a test for copy-chunk across shares
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-03 19:59:08 +02:00
Ralph Boehme
47600c4977 s4/torture: pass destination tree to test_setup_copy_chunk
No change in behaviour, will be used in subsequent commits.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-03 19:59:07 +02:00
Ralph Boehme
6211eb1462 s4/torture: smb2.ioctl: add copy-chunk test with stream to smb2.ioctl
Bug: https://bugzilla.samba.org/show_bug.cgi?id=12787

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2017-05-17 23:02:09 +02:00
Ralph Boehme
f9a61d790f s4/torture: smb2.ioctl: add src and dst path args to test_setup_copy_chunk
Just let the caller pass in the paths, no change in behaviour. A new
test in a subsequent commit will use it to pass paths to streams.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12787

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2017-05-17 23:02:09 +02:00
David Disseldorp
3361b5fca3 torture/ioctl: expect dup_extents(dest=compressed) to pass
The MS-FSCC spec doesn't mention anything about dup-extents against
compressed files.
This can't be tested against Windows, as ReFS doesn't support
compression, but COW clones of compressed files work on Btrfs.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2017-05-10 08:22:18 +02:00
David Disseldorp
3b4d6267d1 torture/ioctl: fix dup_extents destination truncate
The dup_extents_compressed_dest test fails to correctly truncate the
dup_extents destination. Fix it.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2017-05-10 08:22:18 +02:00
Jeremy Allison
6264d21401 s4: tortute: Add a TALLOC_CTX * to torture_smb2_ioctl_init().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2017-05-05 15:52:12 +02:00
David Disseldorp
6fde123176 torture/ioctl: test set_compression(format_none)
This test case was overlooked in the previous bso#12144 update -
set compression requests with format=COMPRESSION_FORMAT_NONE should
succeed if the server / backing storage doesn't offer compression
support.
Confirm that Samba matches Windows Server 2016 ReFS behaviour here.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144

Reported-by: Nick Barrett <nick@barrett.org.nz>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-01-09 19:31:20 +01:00
David Disseldorp
f6f6263f1f torture/ioctl: test compression responses when unsupported
Confirm that Samba matches Windows Server 2016 ReFS behaviour here.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144

Reported-by: Nick Barrett
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct  6 06:14:34 CEST 2016 on sn-devel-144
2016-10-06 06:14:34 +02:00
David Disseldorp
bff3e5efba torture/ioctl: switch sparse src/dest dup ext behaviour
Contrary to 2.3.8 FSCTL_DUPLICATE_EXTENTS_TO_FILE
STATUS_NOT_SUPPORTED: Target file is sparse, while source is a
non-sparse file.

...Windows Server 2016 RTM appears to respond the other way around.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Sep 23 00:23:09 CEST 2016 on sn-devel-144
2016-09-23 00:23:08 +02:00
David Disseldorp
710f06702b torture/smb2/ioctl: don't check for untruncated dest failure
This should fail, but passes against WS2016 RTM...

2.3.8 FSCTL_DUPLICATE_EXTENTS_TO_FILE Reply:
The destination range extends beyond the target file's allocation size.
The caller might need to increase the target's allocation size before
using FSCTL_DUPLICATE_EXTENTS_TO_FILE.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-22 20:40:08 +02:00
David Disseldorp
281ce600de torture/ioctl: add FSCTL_DUP_EXTENTS_TO_FILE tests
FSCTL_DUPLICATE_EXTENTS_TO_FILE is yet another copy offload mechanism,
this time only targeting COW FSes, where the request triggers a meta-
data only clone of the source range.

These tests attempt to cover most of the normal use cases, as well as
number of more exotic scenarios.

FILE_SUPPORTS_BLOCK_REFCOUNTING FS attribute presence is checked prior
to running the tests, so they will currently be skipped during Samba
self test (which lacks the flag).

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-22 20:40:08 +02:00
David Disseldorp
de7d7ac608 torture/ioctl: make sparse file support check generic
Rename test_ioctl_sparse_fs_supported() to test_ioctl_fs_supported() and
allow callers to query generic FileSystemAttributes flags via the new
fs_support_flags parameter.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-22 20:40:07 +02:00
Uri Simchoni
5bf11f6f5b s4-smbtorture: pin copychunk exec right behavior
Add tests that show copychunk behavior when the
source and dest handles have execute right instead
of read-data right.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12149

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-08-16 11:31:27 +02:00
Uri Simchoni
6ce0304eda seltest: allow opening files with arbitrary rights in smb2.ioctl tests
Separate file creation (which requires write access) from the
opening of the file for the test (which might be without write
access).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12149

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-08-16 11:31:27 +02:00
David Disseldorp
74ff89a7e3 torture/ioctl: add simple FSCTL_FILE_LEVEL_TRIM test
This test writes out a 128K file and then attempts to trim the first
half of the file. Trim support is first detected using an
FS_SECTOR_SIZE_INFORMATION query-info request. If the server doesn't
support trim, then the test is skipped.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 18 21:32:47 CET 2015 on sn-devel-104
2015-03-18 21:32:46 +01:00
Volker Lendecke
ee087f8d6d torture4: Fix systems with a 32-bit "long"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Mar 10 18:05:13 CET 2015 on sn-devel-104
2015-03-10 18:05:13 +01:00
David Disseldorp
95a6a892d9 torture/ioctl: add range overflow QAR test
Issue a QAR request with an offset and length that generate an integer
(uint64_t) overflow when summed together. This should result in an
NT_STATUS_INVALID_PARAMETER response, as confirmed against Windows
Server 2012 & 2008.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 10 00:02:18 CET 2015 on sn-devel-104
2015-03-10 00:02:18 +01:00
David Disseldorp
27e19a81e6 torture/ioctl: add multi-range QAR test
Write 10 x 64K ranges, with 64K holes punched in between. Afterwards,
check that all ranges are present in the QAR response.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:08 +01:00
David Disseldorp
2edb6ddc31 torture/ioctl: add QAR off-by-one bug paranoia test
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:08 +01:00
David Disseldorp
e27ea1bcbb torture/ioctl: test sparse file operation locking
An exclusively locked file can still be marked sparse. QAR requests
covering the locked-range should also succed. ZERO_DATA requests are
blocked.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:08 +01:00
David Disseldorp
55d8ac5280 torture/ioctl: add ioctl_sparse_perms test
This test confirms that correct FSCTL_SET_SPARSE permission checks are
in place on the server.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:08 +01:00
David Disseldorp
6729557c27 torture/ioctl: rework and reduce pattern helper IO sizes
check_pattern() currently attempts to read all data in one go. Fix it to
use a 64K maximum IO size so that it works against Windows Server 2008.

Additionally, rework write_pattern() so that it only allocates a buffer
for the largest IO size (now 64K), rather than for the full write
length.

Finally, assert that callers are correctly performing pattern IO in
8-byte increments - copy_chunk_tiny was not, so fix it.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
David Disseldorp
4dec434f71 torture/ioctl: add sparse_punch_invalid test
Attempt to extend a file using ZERO_DATA. The operation should succeed,
but the file should not be extended, as specified in MS-FSCC <58>
Section 2.3.65:
  This FSCTL sets the range of bytes to zero (0) without extending the
  file size.

Also test zero length and invalid BFZ requests.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
David Disseldorp
81065a4801 torture/ioctl: remove FS specific sparse copy-chunk expectations
NTFS deallocates an entire file when a sparse zero-data request spans
the full length. Other filesystems (e.g. EXT4 and Btrfs) do not.

vfs_btrfs is additionally capable of preserving sparse regions for
copy-chunk, using the BTRFS_IOC_CLONE_RANGE ioctl. This should not be
treated as a failure.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
David Disseldorp
904d5809e5 torture/ioctl: remove FS specific sparse punch check
Samba uses PUNCH_HOLE to zero a range, and subsequently uses fallocate()
to allocate the punched range if the file is marked non-sparse and
"strict allocate" is enabled.

In both cases, the zeroed range will not be detected by SEEK_DATA, so
the range won't be present in QAR responses until the file is marked
non-sparse again.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
David Disseldorp
f5c472ea47 torture/ioctl: remove 64K chunk size assumptions
These tests assumed that 4K chunks remain allocated following write at
a subsequent offset. This is not the case for other filesystems (E.g.
XFS, Btrfs, Etc.), which may deallocate the chunk.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
David Disseldorp
b5a635fb0a idl/ioctl: change QAR response array to a DATA_BLOB
[MS-FSCC] specifies:
  The number of FILE_ALLOCATED_RANGE_BUFFER elements returned is
  computed by dividing the size of the returned output buffer (from
  either SMB or SMB2, the lower-layer protocol that carries the FSCTL)
  by the size of the FILE_ALLOCATED_RANGE_BUFFER element.

Ideally, this requirement could be defined in idl with the following:
  [flag(NDR_REMAINING)] file_alloced_range_buf array[];

However, this is not currently supported by PIDL, so just use an opaque
data blob for now.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
David Disseldorp
177692c004 torture/ioctl: add test_ioctl_sparse_copy_chunk test
This test copies unallocated and allocated ranges from a sparse file
into a sparse and non-sparse destination file using FSCTL_SRV_COPYCHUNK.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 12 03:19:32 CET 2015 on sn-devel-104
2015-02-12 03:19:32 +01:00
David Disseldorp
048068e836 torture/ioctl: add sparse_compressed test
This test checks whether a file marked with sparse and compression
attributes is deallocated following FSCTL_SET_ZERO_DATA.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-02-12 00:50:09 +01:00
David Disseldorp
200bab0420 torture/ioctl: extend sparse_hole_dealloc test
Check whether unwritten extents in a sparse file are allocated.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-02-12 00:50:09 +01:00
David Disseldorp
c7f1284f03 torture/ioctl: add sparse_hole_dealloc test
This test finds the minimum length at which a zeroed range in a sparse
file is deallocated by the underlying filesystem.
It also checks whether zeroed neighbours are merged for deallocation.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-02-12 00:50:09 +01:00
David Disseldorp
af9a99c35c torture/ioctl: fix check_[zero/pattern]() for len=0
Subtraction currently triggers an underflow.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-02-12 00:50:09 +01:00
David Disseldorp
cd87d9f782 torture: basic FSCTL_SET_ZERO_DATA tests
Attempt to punch holes in a file using FSCTL_SET_ZERO_DATA. Check that
the resulting data is zeroed. Also confirm that when the file is marked
sparse, the zeroed range is no longer allocated.
Finally, check that removing the sparse flag causes any holes to be
unsparsed.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Sep  8 21:40:34 CEST 2014 on sn-devel-104
2014-09-08 21:40:34 +02:00
David Disseldorp
5d8bfb5c41 torture: add file zero-range checker
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-09-08 19:11:13 +02:00
David Disseldorp
750e67aeb2 torture: malformed FSCTL_QUERY_ALLOCATED_RANGES tests
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-09-08 19:11:13 +02:00
David Disseldorp
10e86bf481 torture: basic FSCTL_QUERY_ALLOCATED_RANGES test
Add a test and helper function for FSCTL_QUERY_ALLOCATED_RANGES
requests.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-09-08 19:11:13 +02:00
David Disseldorp
9a9cae9555 torture: split pattern write into helper function
This allows for patterned writes after file creation, as needed for
sparse file integrity testing.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-09-08 19:11:12 +02:00
David Disseldorp
3fcbfa967a torture: test oversize FSCTL_SET_SPARSE request
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-09-08 19:11:12 +02:00
David Disseldorp
5e3b5b53b2 torture: trivial test_ioctl_network_interface_info cleanup
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
2014-08-29 19:40:13 +02:00
David Disseldorp
a3aee061b4 torture: test FSCTL_SET_SPARSE without SetSparse buffer
This test checks for the following MS-FSCC 2.3.63 behaviour:

If there is no data element, the sparse flag for the file is set,
exactly as if the FILE_SET_SPARSE_BUFFER element was supplied and had a
SetSparse value of TRUE.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
2014-08-29 19:40:13 +02:00
David Disseldorp
9a3e88bc0a torture: test FSCTL_SET_SPARSE against a directory
Expect STATUS_INVALID_PARAMETER, as is returned by Windows Server 2012
and 2008. Samba is currently broken, in that it currently processes the
request and sets the sparse DOS attribute on the directory - fix to
follow.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
2014-08-29 19:40:13 +02:00
David Disseldorp
9dc7aaf952 torture: test FSCTL_SET_SPARSE
Check that the FILE_ATTRIBUTE_SPARSE is set following FSCTL_SET_SPARSE.
Also confirm that adding the attribute on create doesn't carry through
to subsequent SMB2_GETINFO_FILE requests.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allson <jra@samba.org>
2014-08-29 19:40:13 +02:00
Anubhav Rakshit
017db6d0f8 torture: Add FSCTL_QUERY_NETWORK_INTERFACE_INFO torture test case to source4/torture/smb2/ioctl.c
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-24 19:07:06 +02:00
David Disseldorp
54d07da81e torture: add zero length FSCTL_SRV_COPYCHUNK test
Windows Server 2012 returns NT_STATUS_INVALID_PARAMETER for
FSCTL_SRV_COPYCHUNK requests that include a server-side copy length of
zero, in line with MS-SMB2 3.3.5.15.6.

We should match this behaviour, so test for it.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-02-06 16:15:26 -08:00
David Disseldorp
cb353a34dd torture: test get/set compression ioctl permissions
Windows Server 2012[r2] exhibits some strange behaviour with regard
to handling the compression fsctls.
[READ/WRITE]_ATTR permissions are not required for the corresponding
get/set compression ioctls. WRITE_DATA is required for set compression.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov 22 19:57:48 CET 2013 on sn-devel-104
2013-11-22 19:57:48 +01:00
David Disseldorp
aa197c18c4 torture: split open from test_setup_create_fill
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-22 08:56:45 -08:00