[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Tue Nov 8 18:37:04 MST 2011
The branch, master has been updated
via 4c52e8f s4:torture:smb2: rewrite durable-open.open test to use smb2_*_create functions
via 9d862c0 s4:torture:smb2: rewrite the durable-open.lock test to use smb2_lease_create()
via 0652b21 s4:torture:smb2: rewrite the durable-open.lease test to use smb2_lease_create()
via cda1006 s4:torture:smb2: rewrite the durable-open.oplock test to use smb2_oplock_create()
via 5d3b6aa s4:torture:smb2: rewrite the durable-open.file-position test to use smb2_oplock_create()
via 6e721fd s4:torture:smb2: rewrite the durable-open.open2 test to use smb2_lease_create_share()
via afc94fe s4:torture:smb2: rewrite the durable-open.open1 test to use smb2_oplock_create_share()
via cb98e31 s4:torture:smb2: add smb2_oplock_create_share() that takes sharemode as parameter
via 901cab2 s4:torture:smb2: add smb2_lease_create_share() that takes a sharemode as parameter
via ef6c097 s4:torture:smb2: add smb2_generic_create_share() that also takes the sharemode as parameter
via 4746edc s4:torture:smb2: move the smb2_create_*() utility functions from lease.c to util.c for re-use
via a5d8614 s4:torture:smb2: use smb2_util_oplock_level() in the durable-open test for convenience
via 3078c27 s4:torture:smb2: lease: oplock_level is uint8_t, not uint32_t or int
via 7f19208 s4:torture:smb2: move oplock() from lease.c to smb2_util_oplock_level() in util.c for re-use
via b47edad s4:torture:smb2: extract map_sharemode() to smb2_util_share_access() in util.c
via 4ea5ac0 s4:torture:smb2: use common smb2_util_lease_state() in the lease tests
via 33ccdf8 s4:torture:smb2: extract map_lease() to util.c as smb2_util_lease_state().
via 9fe4709 s4:torture:smb2: fix illegal write/uninitialized data bug in the lease.multibreak test
via b76bd39 s4:torture:smb2: lease.update2: some more reasonable struct names and a comment
via 8dab942 s4:torture:smb2: change the test file name in the durable-open.oplock test
from 8a18edf samr: filterModuleName is a lsa_String in userPwdChangeFailureInformation.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4c52e8f68b9ca8f2e4694e8ead86f83321d66dbe
Author: Michael Adam <obnox at samba.org>
Date: Wed Nov 9 00:22:55 2011 +0100
s4:torture:smb2: rewrite durable-open.open test to use smb2_*_create functions
Autobuild-User: Michael Adam <obnox at samba.org>
Autobuild-Date: Wed Nov 9 02:36:36 CET 2011 on sn-devel-104
commit 9d862c00e5563b8ccd47df18f7b7645b370620ab
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 22:03:04 2011 +0100
s4:torture:smb2: rewrite the durable-open.lock test to use smb2_lease_create()
commit 0652b21c68ba82c6cfa67a43318b756fb679a513
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 21:59:18 2011 +0100
s4:torture:smb2: rewrite the durable-open.lease test to use smb2_lease_create()
commit cda10063abe73c2605f8396dca6cbe1fe2554bc3
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:48:25 2011 +0100
s4:torture:smb2: rewrite the durable-open.oplock test to use smb2_oplock_create()
commit 5d3b6aa674618e62e238cd6bac16b6e3ddaebebb
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:44:54 2011 +0100
s4:torture:smb2: rewrite the durable-open.file-position test to use smb2_oplock_create()
commit 6e721fdd43dbae8a558dca3dbbc34fed2b163f82
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:39:45 2011 +0100
s4:torture:smb2: rewrite the durable-open.open2 test to use smb2_lease_create_share()
commit afc94fea2af6e06c3ebcd08cc48d9ebb9484c338
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:31:17 2011 +0100
s4:torture:smb2: rewrite the durable-open.open1 test to use smb2_oplock_create_share()
commit cb98e31b2458d4f6aceabd888f276ef65b2518bd
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:22:47 2011 +0100
s4:torture:smb2: add smb2_oplock_create_share() that takes sharemode as parameter
commit 901cab2deff08917471998bede7fcd245cd89266
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:19:54 2011 +0100
s4:torture:smb2: add smb2_lease_create_share() that takes a sharemode as parameter
commit ef6c0974a0899bf5add9bd031db8c734fc5cb536
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:15:12 2011 +0100
s4:torture:smb2: add smb2_generic_create_share() that also takes the sharemode as parameter
commit 4746edc55d9699ad595b95520fddc747611d62b1
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 18:13:41 2011 +0100
s4:torture:smb2: move the smb2_create_*() utility functions from lease.c to util.c for re-use
commit a5d8614e63cb772abc5fc0b448909341e0ccc576
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 16:34:51 2011 +0100
s4:torture:smb2: use smb2_util_oplock_level() in the durable-open test for convenience
commit 3078c27be1e0d204fe27af0f4f23f425f96b4f29
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 16:33:56 2011 +0100
s4:torture:smb2: lease: oplock_level is uint8_t, not uint32_t or int
commit 7f1920801beca3d098c69a9a681e8a88e12f086d
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 16:26:02 2011 +0100
s4:torture:smb2: move oplock() from lease.c to smb2_util_oplock_level() in util.c for re-use
commit b47edad6731dd3bda288e6cbe4c7420496b3e6e2
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 08:34:38 2011 +0100
s4:torture:smb2: extract map_sharemode() to smb2_util_share_access() in util.c
commit 4ea5ac04b2bdff0fd2a709e8ebfa06221fb642bf
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 08:12:55 2011 +0100
s4:torture:smb2: use common smb2_util_lease_state() in the lease tests
commit 33ccdf88f975e5ccfbeaf978e059841bc2150985
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 8 08:04:28 2011 +0100
s4:torture:smb2: extract map_lease() to util.c as smb2_util_lease_state().
commit 9fe4709a4b4cb4fd5bad6d8c8655e94aa59a03cf
Author: Michael Adam <obnox at samba.org>
Date: Wed Nov 2 15:46:49 2011 +0100
s4:torture:smb2: fix illegal write/uninitialized data bug in the lease.multibreak test
commit b76bd39b6fb0c60dda51b48ad43ce55791e6086e
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 1 23:50:01 2011 +0100
s4:torture:smb2: lease.update2: some more reasonable struct names and a comment
commit 8dab942d1ceeddef9ad314e04a7f6c219b2601ea
Author: Michael Adam <obnox at samba.org>
Date: Tue Nov 1 14:55:37 2011 +0100
s4:torture:smb2: change the test file name in the durable-open.oplock test
to a more reasonable name. This one must have been copied
from the durable-open.lease test.
-----------------------------------------------------------------------
Summary of changes:
source4/torture/smb2/durable_open.c | 318 ++++++++---------------------------
source4/torture/smb2/lease.c | 200 ++++++----------------
source4/torture/smb2/util.c | 149 ++++++++++++++++
3 files changed, 277 insertions(+), 390 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 4bce89b..512f432 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -50,50 +50,6 @@
} while(0)
-static inline uint32_t map_lease(const char *ls)
-{
- uint32_t val = 0;
- int i;
-
- for (i = 0; i < strlen(ls); i++) {
- switch (ls[i]) {
- case 'R':
- val |= SMB2_LEASE_READ;
- break;
- case 'H':
- val |= SMB2_LEASE_HANDLE;
- break;
- case 'W':
- val |= SMB2_LEASE_WRITE;
- break;
- }
- }
-
- return val;
-}
-
-static inline uint32_t map_sharemode(const char *sharemode)
-{
- uint32_t val = NTCREATEX_SHARE_ACCESS_NONE; /* 0 */
- int i;
-
- for (i = 0; i < strlen(sharemode); i++) {
- switch(sharemode[i]) {
- case 'R':
- val |= NTCREATEX_SHARE_ACCESS_READ;
- break;
- case 'W':
- val |= NTCREATEX_SHARE_ACCESS_WRITE;
- break;
- case 'D':
- val |= NTCREATEX_SHARE_ACCESS_DELETE;
- break;
- }
- }
-
- return val;
-}
-
/**
* basic durable_open test.
* durable state should only be granted when requested
@@ -103,7 +59,7 @@ static inline uint32_t map_sharemode(const char *sharemode)
*/
struct durable_open_vs_oplock {
- uint8_t level;
+ const char *level;
const char *share_mode;
bool expected;
};
@@ -113,47 +69,46 @@ struct durable_open_vs_oplock {
#define NUM_OPLOCK_OPEN_TESTS ( NUM_OPLOCK_TYPES * NUM_SHARE_MODES )
struct durable_open_vs_oplock durable_open_vs_oplock_table[NUM_OPLOCK_OPEN_TESTS] =
{
- { SMB2_OPLOCK_LEVEL_NONE, "", false },
- { SMB2_OPLOCK_LEVEL_NONE, "R", false },
- { SMB2_OPLOCK_LEVEL_NONE, "W", false },
- { SMB2_OPLOCK_LEVEL_NONE, "D", false },
- { SMB2_OPLOCK_LEVEL_NONE, "RD", false },
- { SMB2_OPLOCK_LEVEL_NONE, "RW", false },
- { SMB2_OPLOCK_LEVEL_NONE, "WD", false },
- { SMB2_OPLOCK_LEVEL_NONE, "RWD", false },
-
- { SMB2_OPLOCK_LEVEL_II, "", false },
- { SMB2_OPLOCK_LEVEL_II, "R", false },
- { SMB2_OPLOCK_LEVEL_II, "W", false },
- { SMB2_OPLOCK_LEVEL_II, "D", false },
- { SMB2_OPLOCK_LEVEL_II, "RD", false },
- { SMB2_OPLOCK_LEVEL_II, "RW", false },
- { SMB2_OPLOCK_LEVEL_II, "WD", false },
- { SMB2_OPLOCK_LEVEL_II, "RWD", false },
-
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "R", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "W", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "D", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "RD", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "RW", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "WD", false },
- { SMB2_OPLOCK_LEVEL_EXCLUSIVE, "RWD", false },
-
- { SMB2_OPLOCK_LEVEL_BATCH, "", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "R", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "W", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "D", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "RD", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "RW", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "WD", true },
- { SMB2_OPLOCK_LEVEL_BATCH, "RWD", true },
+ { "", "", false },
+ { "", "R", false },
+ { "", "W", false },
+ { "", "D", false },
+ { "", "RD", false },
+ { "", "RW", false },
+ { "", "WD", false },
+ { "", "RWD", false },
+
+ { "s", "", false },
+ { "s", "R", false },
+ { "s", "W", false },
+ { "s", "D", false },
+ { "s", "RD", false },
+ { "s", "RW", false },
+ { "s", "WD", false },
+ { "s", "RWD", false },
+
+ { "x", "", false },
+ { "x", "R", false },
+ { "x", "W", false },
+ { "x", "D", false },
+ { "x", "RD", false },
+ { "x", "RW", false },
+ { "x", "WD", false },
+ { "x", "RWD", false },
+
+ { "b", "", true },
+ { "b", "R", true },
+ { "b", "W", true },
+ { "b", "D", true },
+ { "b", "RD", true },
+ { "b", "RW", true },
+ { "b", "WD", true },
+ { "b", "RWD", true },
};
static bool test_one_durable_open_open1(struct torture_context *tctx,
struct smb2_tree *tree,
const char *fname,
- struct smb2_create io,
struct durable_open_vs_oplock test)
{
NTSTATUS status;
@@ -161,19 +116,22 @@ static bool test_one_durable_open_open1(struct torture_context *tctx,
struct smb2_handle _h;
struct smb2_handle *h = NULL;
bool ret = true;
+ struct smb2_create io;
smb2_util_unlink(tree, fname);
- io.in.fname = fname;
- io.in.share_access = map_sharemode(test.share_mode);
- io.in.oplock_level = test.level;
+ smb2_oplock_create_share(&io, fname,
+ smb2_util_share_access(test.share_mode),
+ smb2_util_oplock_level(test.level));
+ io.in.durable_open = true;
+
status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, test.expected);
- CHECK_VAL(io.out.oplock_level, test.level);
+ CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level(test.level));
done:
if (h != NULL) {
@@ -189,7 +147,6 @@ bool test_durable_open_open1(struct torture_context *tctx,
struct smb2_tree *tree)
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
- struct smb2_create io;
char fname[256];
bool ret = true;
int i;
@@ -199,28 +156,12 @@ bool test_durable_open_open1(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
- ZERO_STRUCT(io);
- io.in.security_flags = 0x00;
- io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io.in.create_flags = 0x00000000;
- io.in.reserved = 0x00000000;
- io.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io.in.durable_open = true;
- io.in.fname = fname;
-
/* test various oplock levels with durable open */
for (i = 0; i < NUM_OPLOCK_OPEN_TESTS; i++) {
ret = test_one_durable_open_open1(tctx,
tree,
fname,
- io,
durable_open_vs_oplock_table[i]);
if (ret == false) {
goto done;
@@ -302,7 +243,6 @@ struct durable_open_vs_lease durable_open_vs_lease_table[NUM_LEASE_OPEN_TESTS] =
static bool test_one_durable_open_open2(struct torture_context *tctx,
struct smb2_tree *tree,
const char *fname,
- struct smb2_create io,
struct durable_open_vs_lease test)
{
NTSTATUS status;
@@ -310,22 +250,19 @@ static bool test_one_durable_open_open2(struct torture_context *tctx,
struct smb2_handle _h;
struct smb2_handle *h = NULL;
bool ret = true;
+ struct smb2_create io;
struct smb2_lease ls;
uint64_t lease;
smb2_util_unlink(tree, fname);
- io.in.fname = fname;
- io.in.share_access = map_sharemode(test.share_mode);
- io.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
-
lease = random();
- ZERO_STRUCT(ls);
- ls.lease_key.data[0] = lease;
- ls.lease_key.data[1] = ~lease;
- ls.lease_state = map_lease(test.type);
- io.in.lease_request = &ls;
+ smb2_lease_create_share(&io, &ls, false /* dir */, fname,
+ smb2_util_share_access(test.share_mode),
+ lease,
+ smb2_util_lease_state(test.type));
+ io.in.durable_open = true;
status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -336,7 +273,8 @@ static bool test_one_durable_open_open2(struct torture_context *tctx,
CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_LEASE);
CHECK_VAL(io.out.lease_response.lease_key.data[0], lease);
CHECK_VAL(io.out.lease_response.lease_key.data[1], ~lease);
- CHECK_VAL(io.out.lease_response.lease_state, map_lease(test.type));
+ CHECK_VAL(io.out.lease_response.lease_state,
+ smb2_util_lease_state(test.type));
done:
if (h != NULL) {
smb2_util_close(tree, *h);
@@ -351,7 +289,6 @@ bool test_durable_open_open2(struct torture_context *tctx,
struct smb2_tree *tree)
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
- struct smb2_create io;
char fname[256];
bool ret = true;
int i;
@@ -361,20 +298,6 @@ bool test_durable_open_open2(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
- ZERO_STRUCT(io);
- io.in.security_flags = 0x00;
- io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io.in.create_flags = 0x00000000;
- io.in.reserved = 0x00000000;
- io.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io.in.durable_open = true;
- io.in.fname = fname;
/* test various oplock levels with durable open */
@@ -382,7 +305,6 @@ bool test_durable_open_open2(struct torture_context *tctx,
ret = test_one_durable_open_open2(tctx,
tree,
fname,
- io,
durable_open_vs_lease_table[i]);
if (ret == false) {
goto done;
@@ -417,24 +339,8 @@ bool test_durable_open_file_position(struct torture_context *tctx,
smb2_util_unlink(tree1, fname);
- ZERO_STRUCT(io1);
- io1.in.security_flags = 0x00;
- io1.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
- io1.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io1.in.create_flags = 0x00000000;
- io1.in.reserved = 0x00000000;
- io1.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io1.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io1.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
- NTCREATEX_SHARE_ACCESS_WRITE |
- NTCREATEX_SHARE_ACCESS_DELETE;
- io1.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io1.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io1.in.durable_open = true;
- io1.in.fname = fname;
+ smb2_oplock_create(&io1, fname, SMB2_OPLOCK_LEVEL_BATCH);
+ io1.in.durable_open = true;
status = smb2_create(tree1, mem_ctx, &io1);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -535,33 +441,17 @@ bool test_durable_open_oplock(struct torture_context *tctx,
bool ret = true;
/* Choose a random name in case the state is left a little funky. */
- snprintf(fname, 256, "durable_open_lease_%s.dat", generate_random_str(tctx, 8));
+ snprintf(fname, 256, "durable_open_oplock_%s.dat", generate_random_str(tctx, 8));
/* Clean slate */
smb2_util_unlink(tree1, fname);
/* Create with batch oplock */
- ZERO_STRUCT(io1);
- io1.in.security_flags = 0x00;
- io1.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
- io1.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io1.in.create_flags = 0x00000000;
- io1.in.reserved = 0x00000000;
- io1.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io1.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io1.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
- NTCREATEX_SHARE_ACCESS_WRITE |
- NTCREATEX_SHARE_ACCESS_DELETE;
- io1.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io1.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io1.in.fname = fname;
- io1.in.durable_open = true;
+ smb2_oplock_create(&io1, fname, SMB2_OPLOCK_LEVEL_BATCH);
+ io1.in.durable_open = true;
io2 = io1;
- io2.in.create_disposition = NTCREATEX_DISP_OPEN;
+ io2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree1, mem_ctx, &io1);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -638,36 +528,13 @@ bool test_durable_open_lease(struct torture_context *tctx,
smb2_util_unlink(tree1, fname);
/* Create with lease */
- ZERO_STRUCT(io1);
- io1.in.security_flags = 0x00;
- io1.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
- io1.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io1.in.create_flags = 0x00000000;
- io1.in.reserved = 0x00000000;
- io1.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io1.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io1.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
- NTCREATEX_SHARE_ACCESS_WRITE |
- NTCREATEX_SHARE_ACCESS_DELETE;
- io1.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io1.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io1.in.fname = fname;
- io1.in.durable_open = true;
-
- ZERO_STRUCT(ls1);
- ls1.lease_key.data[0] = lease1;
- ls1.lease_key.data[1] = ~lease1;
- ls1.lease_state = SMB2_LEASE_READ|SMB2_LEASE_HANDLE|SMB2_LEASE_WRITE;
- io1.in.lease_request = &ls1;
+ smb2_lease_create(&io1, &ls1, false /* dir */, fname,
+ lease1, smb2_util_lease_state("RHW"));
+ io1.in.durable_open = true;
- io2 = io1;
- ls2 = ls1;
- ls2.lease_key.data[0] = lease2;
- ls2.lease_key.data[1] = ~lease2;
- io2.in.lease_request = &ls2;
+ smb2_lease_create(&io2, &ls2, false /* dir */, fname,
+ lease2, smb2_util_lease_state("RHW"));
+ io2.in.durable_open = true;
io2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree1, mem_ctx, &io1);
@@ -759,30 +626,10 @@ bool test_durable_open_lock(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
/* Create with lease */
- ZERO_STRUCT(io);
- io.in.security_flags = 0x00;
- io.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
- io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io.in.create_flags = 0x00000000;
- io.in.reserved = 0x00000000;
- io.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
- NTCREATEX_SHARE_ACCESS_WRITE |
- NTCREATEX_SHARE_ACCESS_DELETE;
- io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io.in.fname = fname;
- io.in.durable_open = true;
- ZERO_STRUCT(ls);
- ls.lease_key.data[0] = lease;
- ls.lease_key.data[1] = ~lease;
- ls.lease_state = SMB2_LEASE_READ|SMB2_LEASE_HANDLE|SMB2_LEASE_WRITE;
- io.in.lease_request = &ls;
+ smb2_lease_create(&io, &ls, false /* dir */, fname, lease,
+ smb2_util_lease_state("RWH"));
+ io.in.durable_open = true;
status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -873,32 +720,13 @@ bool test_durable_open_open(struct torture_context *tctx,
smb2_util_unlink(tree1, fname);
/* Create with lease */
- ZERO_STRUCT(io1);
- io1.in.security_flags = 0x00;
- io1.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
- io1.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
- io1.in.create_flags = 0x00000000;
- io1.in.reserved = 0x00000000;
- io1.in.desired_access = SEC_RIGHTS_FILE_ALL;
- io1.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
- io1.in.share_access = NTCREATEX_SHARE_ACCESS_NONE;
- io1.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io1.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
- NTCREATEX_OPTIONS_ASYNC_ALERT |
- NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
- 0x00200000;
- io1.in.fname = fname;
- io1.in.durable_open = true;
+ smb2_lease_create_share(&io1, &ls, false /* dir */, fname,
+ smb2_util_share_access(""),
+ lease,
+ smb2_util_lease_state("RH"));
+ io1.in.durable_open = true;
- io2 = io1;
- io2.in.oplock_level = SMB2_OPLOCK_LEVEL_NONE;
- io2.in.durable_open = false;
-
- ZERO_STRUCT(ls);
- ls.lease_key.data[0] = lease;
- ls.lease_key.data[1] = ~lease;
- ls.lease_state = SMB2_LEASE_READ|SMB2_LEASE_HANDLE;
- io1.in.lease_request = &ls;
+ smb2_oplock_create(&io2, fname, SMB2_OPLOCK_LEVEL_NONE);
status = smb2_create(tree1, mem_ctx, &io1);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -910,7 +738,7 @@ bool test_durable_open_open(struct torture_context *tctx,
CHECK_VAL(io1.out.lease_response.lease_key.data[0], lease);
CHECK_VAL(io1.out.lease_response.lease_key.data[1], ~lease);
CHECK_VAL(io1.out.lease_response.lease_state,
- SMB2_LEASE_READ|SMB2_LEASE_HANDLE);
+ smb2_util_lease_state("RH"));
/* Disconnect */
talloc_free(tree1);
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index 4b1352b..5669c62 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -25,27 +25,6 @@
#include "torture/torture.h"
#include "torture/smb2/proto.h"
-static inline uint32_t lease(const char *ls) {
- uint32_t val = 0;
- int i;
-
- for (i = 0; i < strlen(ls); i++) {
- switch (ls[i]) {
- case 'R':
--
Samba Shared Repository
More information about the samba-cvs
mailing list