summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-11-08 08:34:38 +0100
committerMichael Adam <obnox@samba.org>2011-11-09 01:02:08 +0100
commitb47edad6731dd3bda288e6cbe4c7420496b3e6e2 (patch)
tree5fddbbde9bfb79b046232a596882911c0a452c94
parent4ea5ac04b2bdff0fd2a709e8ebfa06221fb642bf (diff)
downloadsamba-b47edad6731dd3bda288e6cbe4c7420496b3e6e2.tar.gz
samba-b47edad6731dd3bda288e6cbe4c7420496b3e6e2.tar.bz2
samba-b47edad6731dd3bda288e6cbe4c7420496b3e6e2.zip
s4:torture:smb2: extract map_sharemode() to smb2_util_share_access() in util.c
-rw-r--r--source4/torture/smb2/durable_open.c26
-rw-r--r--source4/torture/smb2/util.c23
2 files changed, 25 insertions, 24 deletions
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 19b9e1d88a..1f2aeae877 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_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
@@ -143,7 +121,7 @@ static bool test_one_durable_open_open1(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
io.in.fname = fname;
- io.in.share_access = map_sharemode(test.share_mode);
+ io.in.share_access = smb2_util_share_access(test.share_mode);
io.in.oplock_level = test.level;
status = smb2_create(tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -294,7 +272,7 @@ static bool test_one_durable_open_open2(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
io.in.fname = fname;
- io.in.share_access = map_sharemode(test.share_mode);
+ io.in.share_access = smb2_util_share_access(test.share_mode);
io.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
lease = random();
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 49ffccda14..5be96b3167 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -521,3 +521,26 @@ uint32_t smb2_util_lease_state(const char *ls)
return val;
}
+
+uint32_t smb2_util_share_access(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;
+}
+