summaryrefslogtreecommitdiff
path: root/source4/torture/smb2/durable_open.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-11-08 08:04:28 +0100
committerMichael Adam <obnox@samba.org>2011-11-09 01:02:08 +0100
commit33ccdf88f975e5ccfbeaf978e059841bc2150985 (patch)
treea75a0f1d7c0eb26306564ec15f5017c6918a3d42 /source4/torture/smb2/durable_open.c
parent9fe4709a4b4cb4fd5bad6d8c8655e94aa59a03cf (diff)
downloadsamba-33ccdf88f975e5ccfbeaf978e059841bc2150985.tar.gz
samba-33ccdf88f975e5ccfbeaf978e059841bc2150985.tar.bz2
samba-33ccdf88f975e5ccfbeaf978e059841bc2150985.zip
s4:torture:smb2: extract map_lease() to util.c as smb2_util_lease_state().
Diffstat (limited to 'source4/torture/smb2/durable_open.c')
-rw-r--r--source4/torture/smb2/durable_open.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index ea0fbfade4..19b9e1d88a 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -50,28 +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 */
@@ -324,7 +302,7 @@ static bool test_one_durable_open_open2(struct torture_context *tctx,
ZERO_STRUCT(ls);
ls.lease_key.data[0] = lease;
ls.lease_key.data[1] = ~lease;
- ls.lease_state = map_lease(test.type);
+ ls.lease_state = smb2_util_lease_state(test.type);
io.in.lease_request = &ls;
status = smb2_create(tree, mem_ctx, &io);
@@ -336,7 +314,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);