1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
Commit Graph

101 Commits

Author SHA1 Message Date
Stefan Metzmacher
1cc1586d84 s4:torture/smb2: add smb2.durable-open.lock-noW-lease
This demonstrates that a W lease is required for a
durable handle to be durable when it has byte range locks.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-10 12:47:33 +00:00
Stefan Metzmacher
e65e1326a0 s4:torture/smb2: improve error handling in durable_open.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15649
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15651

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-10-10 12:47:33 +00:00
Andreas Schneider
2e1ac4bbf5 s4:torture: Initialize pointer with NULL
"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1447: var_decl: Declaring variable ""tree2"" without initializer.
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1492: uninit_use_in_call: Using uninitialized value ""tree2"" when calling ""smb2_util_unlink"".
 1490|   		}
 1491|
 1492|-> 		smb2_util_unlink(tree2, fname);
 1493|
 1494|   		talloc_free(tree);"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2024-07-18 12:47:29 +00:00
Andreas Schneider
57001527ae s4:torture: Initialize pointers
"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1518: var_decl: Declaring variable ""tree2"" without initializer.
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1584: uninit_use_in_call: Using uninitialized value ""tree2"" when calling ""smb2_util_close"".
 1582|   	if (tree != NULL) {
 1583|   		if (h != NULL) {
 1584|-> 			smb2_util_close(tree2, *h);
 1585|   		}
 1586|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2024-06-30 23:20:33 +00:00
Ralph Boehme
fba4b29085 s4:torture: remove remaining checks if alloc_size is 0 on empty files
commit 55b2f247f9 already remove a few of these,
but a few remained.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-09 23:11:38 +00:00
Jeremy Allison
bb329d4de5 s4: torture: Add a new test - samba3.smb2.durable-open.stat-open.
Passes against Windows. Shows that Windows allows a durable handle
on a leased open for READ_ATTRUBUTES only (a stat open).

Mark as knownfail for now.

NB. Not sure why we are testing smb2.durable-open against ad_dc
as that provisioning has "smb2 leases = no" which precludes
granting durable handles. Not changing for this bug but this
should be looked at in future.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-04-29 14:57:29 +00:00
Björn Jacke
37b3c6375b torture: fix durable open/alloc-size test
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2019-07-07 21:32:25 +00:00
Andreas Schneider
55b2f247f9 s4:torture: Do not check if the alloc_size is 0 on empty files
The allocation size might not be zero. This depends on the file system
behavior and also on the size of the extended attributes stored on the
file. E.g. If a large user.DOSATTRIB xattr is stored on XFS/ext4 then 8
blocks are used and we will round up to several megabytes.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-12-12 09:13:23 +01:00
Jeremy Allison
b8a616ef3d s4: torture: Add TALLOC_CTX * to torture_smb2_durable_open_disconnect_init(), torture_smb2_durable_open_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
Volker Lendecke
beda6d3d48 torture: Fix uninitialized variables
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): Thu Oct 20 02:48:30 CEST 2016 on sn-devel-144
2016-10-20 02:48:30 +02:00
Michael Adam
3e90abe670 torture:smb2: add durable-open.reopen1a-lease
Lease variant of the reopen1a test which tests the
relevance of the client guid.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:22 +01:00
Michael Adam
7b557617e4 torture:smb2: for oplocks, durable reconnect works with different client guid
in durabble-open.reopen1a test

Try both original and a different client guid.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:22 +01:00
Michael Adam
505546be57 torture:smb2: durable-open.reopen1a only needs one io struct
Using two is confusing.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:21 +01:00
Michael Adam
37c05f4ade torture:smb2: fix crashes in smb2.durable-open.reopen1a test
If the test failed too early, we dereferenced tree2 which
was still NULL.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:21 +01:00
Michael Adam
b7186a00bb torture:smb2: use assert, not warning in error case in durable-open.reopen1a
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-22 00:23:21 +01:00
Michael Adam
73f01cd2f1 torture:smb2: fix copy'n'paste error in durable-open:open2:lease test
Checking against the correct smb2_create object also lets us
check the correct create action (EXISTED vs CREATED).

Observed when this showed up in flakey test results.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 29 08:34:03 CET 2015 on sn-devel-144
2015-12-29 08:34:03 +01:00
Douglas Bagnall
bbb18875dc Avoid segfault in durable_open tests
There are "goto done"s hiding in CHECK_STATUS in parts of
the code where tree1 is unequivocally NULL.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun 26 05:12:02 CEST 2015 on sn-devel-104
2015-06-26 05:12:02 +02:00
Douglas Bagnall
225d701546 correct sense of macro variable name in SMB2 durable open test
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 24 08:54:23 CEST 2015 on sn-devel-104
2015-06-24 08:54:23 +02:00
Douglas Bagnall
69e511e478 Avoid casting pointer to unsigned long long for NULL check
This allows compilation on i386 with -WError. Otherwise we see
this:

  ../source4/torture/smb2/durable_open.c:41:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
       __location__, #v, (unsigned long long)v, (unsigned long long)correct); \

because the pointer is 32 bits, while long long is 64.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-24 06:04:10 +02:00
Michael Adam
af360ede0e s4:torture:smb2: fix durable-open.reopen4
We currently don't support durable handles with delete-on-close:
with delete-on-close, we close a durable handle with delete-on-close
set upon disconnect.

This patch adapts the test to behave accordingly,
i.e. don't use delete-on-close...

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-01-30 12:26:45 -08:00
Michael Adam
a46059d534 s4:torture:smb2: add new durable-open.reopen1a test
- open session1 on tcp connection conn1
- open a durable handle on a session1
- do a session reconnect on a new tcp connection conn2
- doing a durable reconnect on session1 gives
  USER_SESSION_DELETED
- doing a durable reconnect on session2 succeeds

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-12-06 14:01:34 +01:00
Michael Adam
bd3b922a45 s4:torture:smb2: extend the durable-open.reopen2 test
Add tests for:
- filename and many other things don't matter in reconnect
- additionally specified DHnQ request blob is ignored.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
d8cd54962b s4:torture:smb2: add a durable-open.reopen-lease-v2 test
like durable-open.reopen2-lease but with v2 lease requets

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
1f14747094 s4:torture:smb2: add durable-open.reopen2-lease test
lease-variant of the reopen2 test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
6c6643c364 s4:torture:smb2: fix durable-open lease tests to pass against windows.
Fix is: reconnect with same client-guid as on the first connection.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
a31ea15203 s4:torture:smb2: add smbcli_options argument to torture_smb2_connection_ext()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
14e3f4bd3b s4:torture:smb2: fix a comment in the durable-open.lock-oplock test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:07 +02:00
Gregor Beck
87685b30d7 s4:torture:smb2 delete temp memory context in test_durable_open_oplock_disconnect
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Apr 18 15:10:31 CEST 2013 on sn-devel-104
2013-04-18 15:10:29 +02:00
Stefan Metzmacher
295444266d s4:torture: fix segfault in test_durable_open_open2_oplock()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-18 15:56:20 +01:00
Michael Adam
2f8a033bf2 s4:torture:smb2: fix segfault on error condition in the durable-open.delete_on_close2 test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:56:04 +01:00
Michael Adam
1d3bd45d61 s4:torture:smb2: fix segfault on error condition in the durable-open.delete_on_close1 test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:55:52 +01:00
Michael Adam
98b0e909b7 s4:torture:smb2: fix segfault on error condition in the durable-open.reopen4 test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:55:41 +01:00
Michael Adam
10fcbc6869 s4:torture:smb2: fix segfault on error condition in the durable-open.reopen3 test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:55:30 +01:00
Michael Adam
cb9b8975e5 s4:torture:smb2: fix segfault on error condition in the durable-open.reopen2a test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:55:18 +01:00
Michael Adam
6385f750f1 s4:torture:smb2: fix segfault on error condition in durable-open.reopen2 test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:55:06 +01:00
Michael Adam
6240a7d11e s4:torture:smb2:durable: make test functions static
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:54:38 +01:00
Michael Adam
42bf98d54c s4:torture: add a durable-open-disconnect test (suite)
this opens a durable, disconnects it and exits

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-18 15:54:20 +01:00
Michael Adam
a4c54f6658 s4:torture:smb2: add a durable-open.read-only test
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Sep 23 05:47:30 CEST 2012 on sn-devel-104
2012-09-23 05:47:30 +02:00
Michael Adam
a4358f6ffd s4:torture:smb2: add a durable-open.delete_on_close2 test
This test verifies that the delete on close flag is kept during
a disconnect and is still active on the reconnected handle.
When the reconnected handle is closed, the file is deleted.
2012-09-11 14:29:54 +02:00
Michael Adam
3d7196d0a4 s4:torture:smb2: fix the durable-open.delete_on_close1 test
This test used to flap because there was an invalid check of
the file-id. This might or might not be the same after a
new open. Hence the flapping.

The new version simply opens a file as durable handle with
delete_on_close set, writes a byte and closes the file.
Then on a new connect, the file is opened again, and it is checked
that the file has been created (again) and that it is empty.
2012-09-11 14:29:54 +02:00
Michael Adam
4931a9010f s4:torture:smb2: simplify durable-open.file-position test to only use one I/O and one handle
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-09-07 23:39:42 +02:00
Michael Adam
97be058c9e s4:torture:smb2: change the durable-open.file-position test to use one connection only
And do a tcp disconnect followed by a session reconnect instead
of immediately using the already opened second connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-09-07 23:39:39 +02:00
Michael Adam
e1dd2fc2fa s4:torture:smb2: fix name of test file in the durable-open.alloc-size test
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-09-07 23:39:21 +02:00
Michael Adam
972bf34332 s4:torture:smb2: add a test for alloc size behaviour under durable reconnect
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-07 08:48:05 +02:00
Stefan Metzmacher
1874ebeb37 s4:torture/smb2: check that the server should ignore the fname in a DHnC request
metze
2012-09-07 00:32:30 +02:00
Stefan Metzmacher
afaea04f1c s4:torture/smb2: don't expect a DHnQ response in a DHnC request
This is fixed in Windows 2012 and matches the [MS-SMB2] documentation
now.

metze
2012-09-07 00:32:30 +02:00
Stefan Metzmacher
0c54e7c936 s4:torture/smb2: add smb2.durable-open.lock-oplock
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 22 03:37:54 CEST 2012 on sn-devel-104
2012-06-22 03:37:54 +02:00
Stefan Metzmacher
7d8db45028 s4:torture/smb2: rename smb2.durable-open.lock to smb2.durable-open.lock-lease
metze
2012-06-22 01:47:33 +02:00
Stefan Metzmacher
9089d487c4 s4:torture/smb2: add smb2.durable-open.delete_on_close1
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 21 10:19:00 CEST 2012 on sn-devel-104
2012-06-21 10:19:00 +02:00
Michael Adam
57d99bc14a s4:torture:smb2: rename some of the durable-handle subtests more systematically 2012-03-03 17:03:06 +01:00