summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-05-27 16:02:43 +1000
committerAndrew Tridgell <tridge@samba.org>2008-05-27 16:02:43 +1000
commitc400933c02632caf0f8113594f4b0cd2afbcaef4 (patch)
tree3e7d5e644ab9e9634a0ecb0ca34ae6dac3bfb02c
parent46e64417a3b14d1c33ca7e97080c64f8e67efec2 (diff)
downloadsamba-c400933c02632caf0f8113594f4b0cd2afbcaef4.tar.gz
samba-c400933c02632caf0f8113594f4b0cd2afbcaef4.tar.bz2
samba-c400933c02632caf0f8113594f4b0cd2afbcaef4.zip
added some SMB2 locking tests from gentest
(This used to be commit 2932fcb04646bb921fb1daa365dd4c86cadfe4c0)
-rw-r--r--source4/torture/smb2/lock.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
index 1a56cb9cad..5f43c86b67 100644
--- a/source4/torture/smb2/lock.c
+++ b/source4/torture/smb2/lock.c
@@ -187,6 +187,36 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_lock(tree, &lck);
CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ lck.in.lock_count = 0x0001;
+ lck.in.reserved = 0;
+ lck.in.file.handle = h;
+ el[0].offset = 1;
+ el[0].length = 1;
+ el[0].reserved = 0x00000000;
+ el[0].flags = ~SMB2_LOCK_FLAG_ALL_MASK;
+
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK | SMB2_LOCK_FLAG_EXCLUSIVE;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK | SMB2_LOCK_FLAG_SHARED;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+
done:
return ret;