1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

785 Commits

Author SHA1 Message Date
Michael Adam
f0a113a06e s4:torture:raw:notify: remove CHECK_STATUS.
This macro is not setting torture failure, leading to errors instead
of failures. Use torture_assert_ntstatus_(ok|equal)* macros.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2015-03-30 13:41:26 +02:00
Michael Adam
b92d51f98c s4:torture: avoid free of uninitialized variables in error-case.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-03-23 16:04:19 +01:00
Stefan Metzmacher
116e3ef23c s4:torture/raw: avoid compiler warnings
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-20 20:43:13 +01:00
Volker Lendecke
8c56989325 torture: Fix raw.open.chained-ntcreatex
sizeof(buf) is 5. On FreeBSD10/clang this overwrites "ret". Not good.

Same as 574750777a

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec  9 19:43:31 CET 2014 on sn-devel-104
2014-12-09 19:43:31 +01:00
Volker Lendecke
574750777a torture: Fix raw.open.chained-openx
sizeof(buf) is 5. On FreeBSD10/clang this overwrites "ret". Not good.

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 28 13:30:18 CET 2014 on sn-devel-104
2014-11-28 13:30:18 +01:00
Jeremy Allison
8db5150143 s4:torture: Add smb2.oplock test batch9a and raw.oplock test batch9a
Shows attribute(stat) access open can create a file,
and subsequent attribute(stat) opens don't break oplocks.

Can be extended to explore more varients.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-11-07 20:13:09 +01:00
Andrew Bartlett
01d4c0e804 torture: Provide enough space for test EA name in raw.eas test
The issue is that previously bad_ea_name[5] was the last element on
the array, and so when we later did a strlen() on it, we read past the
end of the stack array.  We need bad_ea_name[5] to be the second-last
element, followed by the \0 placed there by the strlcpy().

Found by AddressSanitizer

Change-Id: I871c08200aa2591c612dfa44da92b83132f83d88
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Sep 11 08:50:16 CEST 2014 on sn-devel-104
2014-09-11 08:50:16 +02:00
Andrew Bartlett
e93affbe1b torture: allow us to correctly use sizeof(buf) in raw.open tests
This changes the sizeof(buf) from sizeof(void *), 8 on 64-bit machines, to sizeof("test") (eg 5).

Found by AddressSanitizer

Andrew Bartlett

Change-Id: I01f18b35c041f3b16be9f6da8ae5d1917d7e24d9
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
2014-09-08 07:26:34 +02:00
Christof Schmitt
f796694aaa torture: Use torture_assert macro for value check in raw.read
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-08-30 00:27:13 +02:00
Christof Schmitt
d29362e85e torture: Use torture_assert macro for status check in raw.read
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-08-30 00:27:13 +02:00
Christof Schmitt
ba8bc46c46 torture: Use torture_fail macro in check_buffer for read requests
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-08-30 00:27:13 +02:00
Christof Schmitt
61dbb57475 torture: Add test for 16 bit alignment of readx data
MS-CIFS requires a one byte pad to guarantee 16 bit alignment of the
data:

Pad (1 byte): This field is optional. When using the NT LAN Manager
dialect, this field can be used to align the Data field to a 16-bit
boundary relative to the start of the SMB Header. If Unicode strings are
being used, this field MUST be present. When used, this field MUST be
one padding byte long.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-08-30 00:27:13 +02:00
Jeremy Allison
c324b9f03f s4: torture: Add a new lock test to show that the Samba SMB1 multi-lock implementation is (currently) correct.
Needed as there was a proposal to re-architect
our multi-lock to dispense with lock order precedence,
which isn't how Windows does it (unfortunately,
as the new code would have been cleaner :-).
Tested against the Win2k12 SMB1 implementation.

This test is designed to show that
lock precedence on the server is based
on the order received, not on the ability
to grant. For example:

A blocked lock request containing 2 locks
will be satified before a subsequent blocked
lock request over one of the same regions,
even if that region is then unlocked. E.g.

(a) lock 100->109, 120->129 (granted)
(b) lock 100->109, 120-129 (blocks)
(c) lock 100->109          (blocks)
(d) unlock 100->109

lock (c) will not be granted as lock (b)
will take precedence.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jul  8 10:16:59 CEST 2014 on sn-devel-104
2014-07-08 10:16:59 +02:00
Volker Lendecke
0c97b7eb53 torture4: Make raw.lock.multilock fail after 20 seconds
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul  4 00:04:10 CEST 2014 on sn-devel-104
2014-07-04 00:04:10 +02:00
Volker Lendecke
4205463ef1 torture4: Adapt comment to code
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-03 21:41:12 +02:00
Jeremy Allison
64346a134d s4: smbtorture: Add multi-lock test. Regression test for bug #10684.
Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
2014-07-03 21:41:12 +02:00
Volker Lendecke
8fa0cde05f torture4: Add a little test that truncate actually works :-)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Jun 25 13:37:24 CEST 2014 on sn-devel-104
2014-06-25 13:37:24 +02:00
Jeremy Allison
c4f7c02137 s4: torture: Add regression test case for #10671 - Samba file corruption as a result of failed lock check.
Adds a new test to raw.open.

Opens a file with SHARE_NONE, writes 1 byte at offset 1023,
attempts a second open with r/w access+truncate disposition,
then checks that open fails with SHARING_VIOLATION, and
the file is not truncated (is still size 1024). Correctly
detects the bug and fixed smbd for me.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2014-06-25 11:22:12 +02:00
Andrew Bartlett
dbe07a49c7 torture: convert raw.mux to use torture_comment() macros instead of printf()
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:13 +02:00
Andrew Bartlett
794eb404e7 torture: convert raw.mux to use torture_assert() macros
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:13 +02:00
Andrew Bartlett
567e0a88db torture: convert CHECK_STATUS into torture_assert_ntstatus_equal in raw.mux tests
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:13 +02:00
Stefan Metzmacher
46eb9fa23c s4:torture/raw: fix debug message in torture_raw_qfileinfo_pipe()
We no longer use dcerpc_pipe_open_smb() there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-03-25 00:45:29 +01:00
Andreas Schneider
4f06c681b9 s4-torture: Use talloc for asprintf.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-12-06 01:14:09 +01:00
Andreas Schneider
4cf8f10500 s4-torture: Relax time checking in CHECK_NTTIME.
NTTIME has a nanosecond resolution. We should be tolerate if the system
is busy writing and reading the value. To reproduce this problem just
run the test under valgrind.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-11-12 17:33:12 +01:00
Jeremy Allison
65882152cc Add regression test for bug #10229 - No access check verification on stream files.
Checks against a file with attribute READONLY, and
a security descriptor denying WRITE_DATA access.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov  4 23:10:10 CET 2013 on sn-devel-104
2013-11-04 23:10:10 +01:00
Volker Lendecke
cdd232cc06 torture: Extend the raw.oplock.level_ii_1 test
smbd broke to none twice. Make sure this won't happen again :-)

This used to happen before the MSG_SMB_BREAK_RESPONSE merge. In
process_oplock_break_message we did not call remove_oplock, which would
have prevented this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 23 14:06:13 CEST 2013 on sn-devel-104
2013-10-23 14:06:12 +02:00
Volker Lendecke
64e734019f torture: Add a test showing we have to break L2 at open time
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23 11:59:58 +02:00
Volker Lendecke
9d3e3a736c torture: Add oplock break to l2/none tests
The level we have to break to depends on the create disposition of the
second opener. If it's overwriting, break to none. If it's not, break
to level2.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23 11:51:19 +02:00
Volker Lendecke
96faaf6c1e torture: Check break level in raw.oplock.exclusive5
This is what Windows does in this case, we don't survive that. We break
to LEVEL2 here. Fixes and more precise test to follow.

We don't survive this anymore. Re-enable later.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23 11:49:05 +02:00
Volker Lendecke
7b51e9f8d3 torture: Add reproducer for bug 10216
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-23 11:45:55 +02:00
Stefan Metzmacher
3b53566ebb s4:tortore:raw/qfileinfo: don't use dcerpc_pipe_open_smb() to open a named pipe
We can directly use smb_raw_open() to open a handle to a named pipe.
This avoids the need for the layer violation functions
dcerpc_smb_tree() and dcerpc_smb_fnum().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-17 08:48:47 +13:00
Volker Lendecke
c92ac4c8ee torture: Extend raw.oplock.batch10
With FAKE_LEVEL_II_OPLOCKS around we did not grant LEVEL2 after
a NO_OPLOCK file got written to. Windows does grant LEVEL2 in this
case. With the have_level2_oplocks in brlocks.tdb we can now grant LEVEL2
in this case as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-15 01:52:29 +02:00
Volker Lendecke
6fbbf94def torture: Extend the raw.oplock.doc1 test
If delete_on_close is set, there is no oplock break. Check that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-11 15:07:34 -07:00
Volker Lendecke
b40fcf3f17 torture: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-06 13:54:58 +02:00
Volker Lendecke
196da5925b smbd: Remove FORCE_OPLOCK_BREAK_TO_NONE
This flag existed to break an exclusive or batch oplock in just one
instead of two steps down to "no oplock" when we did an allocation or file
size change.  Running raw.oplock against W2k12 differs in this respect
from W2k3: W2k12 takes two steps (via level2) to break to none. This
removes the special flag that we only had for compatibility with systems
older than W2k12...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Sep  6 00:47:07 CEST 2013 on sn-devel-104
2013-09-06 00:47:07 +02:00
Volker Lendecke
778636920b torture: Adapt raw.oplock to w2k12
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-09-05 13:46:14 -07:00
Jeremy Allison
bb21fc51e4 Add torture tests to raw.eas to check sending Windows invalid names in the middle of an EA list.
Add torture tests to probe the set of invalid
Windows EA names.

Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"

Signed-off-by: Jeremy Allison <jra@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jul 19 11:50:25 CEST 2013 on sn-devel-104
2013-07-19 11:50:25 +02:00
Andreas Schneider
d295e18409 torture: Don't segfault in raw.session on error.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-07-02 12:30:28 -07:00
Andreas Schneider
474eee0df7 torture: Fix comparsion of uninitalized bytes.
As we compare string make sure we have the null terminator.

Found by valgrind.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-07-02 12:22:08 -07:00
Alexander Werth
9018aa82c7 s4-smbtorture: Set result message when failing the inheritance test.
Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-05-09 06:18:21 +02:00
Stefan Metzmacher
599a699ade s4:torture: let raw.read accept larger reads than 0x10000
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 20 21:53:20 CET 2013 on sn-devel-104
2013-03-20 21:53:20 +01:00
Stefan Metzmacher
c9066b057a s4:torture: raw.read fix large reads against windows
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-20 10:07:42 -07:00
Andreas Schneider
1d24fa6919 torture: Fix memcmp of short buffer.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2013-02-22 16:36:13 +01:00
Jeremy Allison
9f83968e1c Add samba3.samba3badnameblob test to check regressions in bug #9215.
Bad name in SMB1 openX can cause a crash in iconv inside glibc.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Oct  1 23:29:25 CEST 2012 on sn-devel-104
2012-10-01 23:29:25 +02:00
Michael Adam
58e62ae776 s4:torture: fix error reporting in the raw.oplock-brl3 test
Error was assigned to a variable that was not returned.

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Sep 14 14:05:20 CEST 2012 on sn-devel-104
2012-09-14 14:05:20 +02:00
Volker Lendecke
814dc3c62b smbtorture: Test that delete requests are not special
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-10 14:58:51 -07:00
Jeremy Allison
7c4ae72851 Now ACL inheritance flags are working, add test_inheritance_flags() back into raw.acls to ensure we don't regress. 2012-08-30 11:01:30 -07:00
Andrew Bartlett
c75b6154e4 s4-torture: Show that we cannot list extended attributes on streams 2012-08-20 21:58:08 +10:00
Andrew Bartlett
f9837d15f3 s4-torture: Show that we cannot have extended attributes on streams 2012-08-20 21:58:07 +10:00
Andrew Bartlett
bf1e27bd8f s4-torture: Improve raw.streams test to cover EAs and to use torture_assert()
The extension of this test is to create an extended attribute, so we
can confirm that the easize field on a stream actually refers to the
parent file.

This has been run against Windows 7.

Andrew Bartlett
2012-08-20 21:58:07 +10:00