[SCM] Samba Shared Repository - branch master updated
Steven Danneman
sdanneman at samba.org
Wed Nov 25 13:56:16 MST 2009
The branch, master has been updated
via f66612f... s4/torture: port SMBv1 RAW-LOCK tests to SMBv2
via 7f14388... s4/libcli: rename previously reserved field in SMB2 LOCK struct
via 65a611e... s4/libcli: Initialize client PID for SMB2 connections
from 95108f1... s3-registry: fix REG_MULTI_SZ handling in registry_push_value.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f66612f62e43b752cb7461da429efd26d1c47296
Author: Steven Danneman <steven.danneman at isilon.com>
Date: Wed Nov 18 16:35:03 2009 -0800
s4/torture: port SMBv1 RAW-LOCK tests to SMBv2
RAW-LOCK ported as:
RAW-LOCK-LOCK, RAW-LOCK-LOCKX -> SMB2-LOCK-LOCK
RAW-PIDHIGH -> removed, no longer relevant
RAW-ASYNC -> SMB2-LOCK-ASYNC, SMB2-LOCK-CANCEL, SMB2-LOCK-CANCEL-TDIS, SMB2-LOCK-CANCEL-LOGOFF
RAW-ERRORCODE -> SMB2-LOCK-ERRORCODE
RAW-CHANGETYPE -> removed, no longer relevant
RAW-ZEROBYTELOCKS -> SMB2-LOCK->ZEROBYTELENGTH
RAW-UNLOCK -> SMB2-LOCK-UNLOCK
RAW-MULTIPLE_UNLOCK -> SMB2-LOCK-MULTIPLE-UNLOCK
RAW-STACKING -> SMB2-LOCK-STACKING
BASE-LOCK ported as:
BASE-LOCK-LOCK1 -> SMB2-LOCK-ERRORCODE, timeout is no longer relevant
BASE-LOCK-LOCK2 -> SMB2-LOCK-CONTEND, SMB2-LOCK-LOCK, SMB2-LOCK-CONTEXT
BASE-LOCK-LOCK3 -> SMB2-LOCK-RANGE
BASE-LOCK-LOCK4 -> SMB2-LOCK-OVERLAP
BASE-LOCK-LOCK5 -> SMB2-LOCK-STACKING
BASE-LOCK-LOCK6 -> SMB2-LOCK-CANCEL, change_locktype no longer relevant
BASE-LOCK-LOCK7 -> SMB2-LOCK-RW-SHARED, SMB2-LOCK-RW-EXCLUSIVE
commit 7f14388721fdfdc4d5e3d36dd5071a0993695815
Author: Steven Danneman <steven.danneman at isilon.com>
Date: Wed Nov 18 17:51:35 2009 -0800
s4/libcli: rename previously reserved field in SMB2 LOCK struct
The lock.in.reserved field has been renamed lock_sequence in the
SMB 2.1 dialect. See MS-SMB 2.2.26.
commit 65a611ec7299ba992d16dff69da47b1b8e16241d
Author: Steven Danneman <steven.danneman at isilon.com>
Date: Wed Nov 18 16:35:16 2009 -0800
s4/libcli: Initialize client PID for SMB2 connections
Set the SMB pid to the Unix pid of the client process.
-----------------------------------------------------------------------
Summary of changes:
source4/libcli/raw/interfaces.h | 2 +-
source4/libcli/smb2/lock.c | 2 +-
source4/libcli/smb2/request.c | 1 +
source4/libcli/smb2/session.c | 4 +
source4/libcli/smb2/smb2.h | 1 +
source4/smb_server/smb2/fileio.c | 2 +-
source4/torture/gentest.c | 2 +-
source4/torture/smb2/durable_open.c | 2 +-
source4/torture/smb2/lock.c | 2058 ++++++++++++++++++++++++++++++++++-
9 files changed, 2036 insertions(+), 38 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index af2158c..4ddfc56 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -2030,7 +2030,7 @@ union smb_lock {
/* static body buffer 48 (0x30) bytes */
/* uint16_t buffer_code; 0x30 */
uint16_t lock_count;
- uint32_t reserved;
+ uint32_t lock_sequence;
/* struct smb2_handle handle; */
struct smb2_lock_element {
uint64_t offset;
diff --git a/source4/libcli/smb2/lock.c b/source4/libcli/smb2/lock.c
index 62c6e5d..f2a76d8 100644
--- a/source4/libcli/smb2/lock.c
+++ b/source4/libcli/smb2/lock.c
@@ -39,7 +39,7 @@ struct smb2_request *smb2_lock_send(struct smb2_tree *tree, struct smb2_lock *io
SSVAL(req->out.body, 0, 0x30);
SSVAL(req->out.body, 0x02, io->in.lock_count);
- SIVAL(req->out.body, 0x04, io->in.reserved);
+ SIVAL(req->out.body, 0x04, io->in.lock_sequence);
smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
for (i=0;i<io->in.lock_count;i++) {
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index 5d09a50..358d133 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -175,6 +175,7 @@ struct smb2_request *smb2_request_init_tree(struct smb2_tree *tree, uint16_t opc
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID, tree->session->uid);
+ SIVAL(req->out.hdr, SMB2_HDR_PID, tree->session->pid);
SIVAL(req->out.hdr, SMB2_HDR_TID, tree->tid);
req->session = tree->session;
req->tree = tree;
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index 9db32c4..1247962 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -26,6 +26,8 @@
#include "libcli/composite/composite.h"
#include "auth/gensec/gensec.h"
+#include <unistd.h>
+
/**
initialise a smb2_session structure
*/
@@ -46,6 +48,8 @@ struct smb2_session *smb2_session_init(struct smb2_transport *transport,
session->transport = talloc_reference(session, transport);
}
+ session->pid = getpid();
+
/* prepare a gensec context for later use */
status = gensec_client_start(session, &session->gensec,
session->transport->socket->event.ctx,
diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h
index fdd2d6f..ba626fb 100644
--- a/source4/libcli/smb2/smb2.h
+++ b/source4/libcli/smb2/smb2.h
@@ -145,6 +145,7 @@ struct smb2_session {
struct smb2_transport *transport;
struct gensec_security *gensec;
uint64_t uid;
+ uint32_t pid;
DATA_BLOB session_key;
bool signing_active;
};
diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c
index 497a6c5..26d0a3e 100644
--- a/source4/smb_server/smb2/fileio.c
+++ b/source4/smb_server/smb2/fileio.c
@@ -345,7 +345,7 @@ void smb2srv_lock_recv(struct smb2srv_request *req)
io->smb2.level = RAW_LOCK_SMB2;
io->smb2.in.lock_count = SVAL(req->in.body, 0x02);
- io->smb2.in.reserved = IVAL(req->in.body, 0x04);
+ io->smb2.in.lock_sequence = IVAL(req->in.body, 0x04);
io->smb2.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x08);
if (req->in.body_size < 24 + 24*(uint64_t)io->smb2.in.lock_count) {
DEBUG(0,("%s: lock buffer too small\n", __location__));
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 3d23ad8..b0ab41c 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -2661,7 +2661,7 @@ static bool handler_smb2_lock(int instance)
parm[0].level = RAW_LOCK_LOCKX;
parm[0].in.file.handle.data[0] = gen_fnum(instance);
parm[0].in.lock_count = gen_lock_count();
- parm[0].in.reserved = gen_reserved32();
+ parm[0].in.lock_sequence = gen_reserved32();
parm[0].in.locks = talloc_array(current_op.mem_ctx,
struct smb2_lock_element,
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 1b14946..d182744 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -433,7 +433,7 @@ bool test_durable_open_lock(struct torture_context *tctx,
ZERO_STRUCT(el);
lck.in.locks = el;
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h;
el[0].offset = 0;
el[0].length = 1;
diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
index 4308ff9..6bba7bd 100644
--- a/source4/torture/smb2/lock.c
+++ b/source4/torture/smb2/lock.c
@@ -1,20 +1,20 @@
-/*
+/*
Unix SMB/CIFS implementation.
SMB2 lock test suite
Copyright (C) Stefan Metzmacher 2006
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -25,23 +25,50 @@
#include "torture/torture.h"
#include "torture/smb2/proto.h"
+#include "torture/util.h"
-
-#define TARGET_SUPPORTS_INVALID_LOCK_RANGE(_tctx) \
- (torture_setting_bool(_tctx, "invalid_lock_range_support", true))
-#define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
+#include "lib/events/events.h"
+#include "param/param.h"
#define CHECK_STATUS(status, correct) do { \
const char *_cmt = "(" __location__ ")"; \
- torture_assert_ntstatus_equal_goto(torture,status,correct,ret,done,_cmt); \
-} while (0)
+ torture_assert_ntstatus_equal_goto(torture,status,correct, \
+ ret,done,_cmt); \
+ } while (0)
+
+#define CHECK_STATUS_CMT(status, correct, cmt) do { \
+ torture_assert_ntstatus_equal_goto(torture,status,correct, \
+ ret,done,cmt); \
+ } while (0)
+
+#define CHECK_STATUS_CONT(status, correct) do { \
+ if (!NT_STATUS_EQUAL(status, correct)) { \
+ torture_result(torture, TORTURE_FAIL, \
+ "(%s) Incorrect status %s - should be %s\n", \
+ __location__, nt_errstr(status), nt_errstr(correct)); \
+ ret = false; \
+ }} while (0)
#define CHECK_VALUE(v, correct) do { \
const char *_cmt = "(" __location__ ")"; \
torture_assert_int_equal_goto(torture,v,correct,ret,done,_cmt); \
-} while (0)
+ } while (0)
-static bool test_valid_request(struct torture_context *torture, struct smb2_tree *tree)
+#define BASEDIR "testlock"
+
+#define TARGET_SUPPORTS_INVALID_LOCK_RANGE(_tctx) \
+ (torture_setting_bool(_tctx, "invalid_lock_range_support", true))
+#define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
+
+#define WAIT_FOR_ASYNC_RESPONSE(req) \
+ while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { \
+ if (event_loop_once(req->transport->socket->event.ctx) != 0) { \
+ break; \
+ } \
+ }
+
+static bool test_valid_request(struct torture_context *torture,
+ struct smb2_tree *tree)
{
bool ret = true;
NTSTATUS status;
@@ -63,7 +90,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
torture_comment(torture, "Test request with 0 locks.\n");
lck.in.lock_count = 0x0000;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h;
el[0].offset = 0x0000000000000000;
el[0].length = 0x0000000000000000;
@@ -73,7 +100,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
lck.in.lock_count = 0x0000;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h;
el[0].offset = 0;
el[0].length = 0;
@@ -83,7 +110,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h;
el[0].offset = 0;
el[0].length = 0;
@@ -106,7 +133,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
lck.in.file.handle.data[0] -=1;
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x123ab1;
+ lck.in.lock_sequence = 0x123ab1;
lck.in.file.handle = h;
el[0].offset = UINT64_MAX;
el[0].length = UINT64_MAX;
@@ -121,7 +148,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
CHECK_VALUE(lck.out.reserved, 0);
}
- lck.in.reserved = 0x123ab2;
+ lck.in.lock_sequence = 0x123ab2;
status = smb2_lock(tree, &lck);
if (TARGET_SUPPORTS_INVALID_LOCK_RANGE(torture)) {
CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
@@ -132,7 +159,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
torture_comment(torture, "Test basic lock stacking.\n");
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x12345678;
+ lck.in.lock_sequence = 0x12345678;
lck.in.file.handle = h;
el[0].offset = UINT32_MAX;
el[0].length = UINT32_MAX;
@@ -153,7 +180,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
CHECK_VALUE(lck.out.reserved, 0);
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x87654321;
+ lck.in.lock_sequence = 0x87654321;
lck.in.file.handle = h;
el[0].offset = 0x00000000FFFFFFFF;
el[0].length = 0x00000000FFFFFFFF;
@@ -163,7 +190,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
CHECK_STATUS(status, NT_STATUS_OK);
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x1234567;
+ lck.in.lock_sequence = 0x1234567;
lck.in.file.handle = h;
el[0].offset = 0x00000000FFFFFFFF;
el[0].length = 0x00000000FFFFFFFF;
@@ -180,7 +207,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
torture_comment(torture, "Test flags field permutations.\n");
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0;
+ lck.in.lock_sequence = 0;
lck.in.file.handle = h;
el[0].offset = 1;
el[0].length = 1;
@@ -231,7 +258,7 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
"requested\n");
lck.in.lock_count = 2;
- lck.in.reserved = 0;
+ lck.in.lock_sequence = 0;
lck.in.file.handle = h;
el[0].offset = 9999;
el[0].length = 1;
@@ -342,7 +369,7 @@ static bool test_lock_read_write(struct torture_context *torture,
CHECK_STATUS(status, NT_STATUS_OK);
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h1;
el[0].offset = 0;
el[0].length = ARRAY_SIZE(buf)/2;
@@ -353,7 +380,7 @@ static bool test_lock_read_write(struct torture_context *torture,
CHECK_VALUE(lck.out.reserved, 0);
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h1;
el[0].offset = ARRAY_SIZE(buf)/2;
el[0].length = ARRAY_SIZE(buf)/2;
@@ -368,7 +395,7 @@ static bool test_lock_read_write(struct torture_context *torture,
cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- cr.in.share_access =
+ cr.in.share_access =
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE;
@@ -413,7 +440,7 @@ static bool test_lock_read_write(struct torture_context *torture,
CHECK_STATUS(status, s->read_h2_status);
lck.in.lock_count = 0x0001;
- lck.in.reserved = 0x00000000;
+ lck.in.lock_sequence = 0x00000000;
lck.in.file.handle = h1;
el[0].offset = ARRAY_SIZE(buf)/2;
el[0].length = ARRAY_SIZE(buf)/2;
@@ -531,34 +558,1999 @@ static bool test_lock_auto_unlock(struct torture_context *torture,
if (TARGET_IS_W2K8(torture)) {
CHECK_STATUS(status, NT_STATUS_OK);
torture_warning(torture, "Target has \"pretty please\" bug. "
- "Every other contending lock request "
- "succeeds.");
+ "A contending lock request on the same handle "
+ "unlocks the lock.\n");
+ } else {
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+ }
+
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+
+done:
+ return ret;
+}
+
+/*
+ test different lock ranges and see if different handles conflict
+*/
+static bool test_lock(struct torture_context *torture,
+ struct smb2_tree *tree)
+{
+ NTSTATUS status;
+ bool ret = true;
+ struct smb2_handle h, h2;
+ uint8_t buf[200];
+ struct smb2_lock lck;
+ struct smb2_lock_element el[2];
+
+ const char *fname = BASEDIR "\\async.txt";
+
+ status = torture_smb2_testdir(tree, BASEDIR, &h);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ smb2_util_close(tree, h);
+
+ status = torture_smb2_testfile(tree, fname, &h);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ ZERO_STRUCT(buf);
+ status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = torture_smb2_testfile(tree, fname, &h2);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ lck.in.locks = el;
+
+ lck.in.lock_count = 0x0001;
+ lck.in.lock_sequence = 0x00000000;
+ lck.in.file.handle = h;
+ el[0].reserved = 0x00000000;
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+
+ torture_comment(torture, "Trying 0/0 lock\n");
+ el[0].offset = 0x0000000000000000;
+ el[0].length = 0x0000000000000000;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h;
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ torture_comment(torture, "Trying 0/1 lock\n");
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+ el[0].offset = 0x0000000000000000;
+ el[0].length = 0x0000000000000001;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+ lck.in.file.handle = h;
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ torture_comment(torture, "Trying 0xEEFFFFF lock\n");
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+ el[0].offset = 0xEEFFFFFF;
+ el[0].length = 4000;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+ lck.in.file.handle = h;
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ torture_comment(torture, "Trying 0xEF00000 lock\n");
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+ el[0].offset = 0xEF000000;
+ el[0].length = 4000;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+ lck.in.file.handle = h;
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ torture_comment(torture, "Trying (2^63 - 1)/1\n");
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+ el[0].offset = 1;
+ el[0].offset <<= 63;
+ el[0].offset--;
+ el[0].length = 1;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+ lck.in.file.handle = h;
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ torture_comment(torture, "Trying 2^63/1\n");
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+ el[0].offset = 1;
+ el[0].offset <<= 63;
+ el[0].length = 1;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
+ lck.in.file.handle = h;
+ el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+
+ torture_comment(torture, "Trying max/0 lock\n");
+ el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE |
+ SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
+ el[0].offset = ~0;
+ el[0].length = 0;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ lck.in.file.handle = h2;
+ 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);
+ lck.in.file.handle = h;
+ status = smb2_lock(tree, &lck);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_lock(tree, &lck);
--
Samba Shared Repository
More information about the samba-cvs
mailing list