From ca847b593d83f7ce09473469bd79531fdc8d0359 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 23 Sep 2010 15:33:36 -0700 Subject: torture: fixed a valgrind error in SMB2-CREATE the lock structure had uninitialised elements, so we sent a random length. This also adds a 1 byte write, so there is real data that is being truncated with the 2nd open --- source4/torture/smb2/create.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/torture') diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c index 2e32ee03a0..3b88bd9588 100644 --- a/source4/torture/smb2/create.c +++ b/source4/torture/smb2/create.c @@ -793,6 +793,7 @@ static bool test_smb2_open_brlocked(struct torture_context *tctx, NTSTATUS status; bool ret = true; struct smb2_handle h; + char b = 42; torture_comment(tctx, "Testing SMB2 open with a byte range locked file\n"); @@ -819,12 +820,17 @@ static bool test_smb2_open_brlocked(struct torture_context *tctx, status = smb2_create(tree, tctx, &(io.smb2)); CHECK_STATUS(status, NT_STATUS_OK); + status = smb2_util_write(tree, io.smb2.out.file.handle, &b, 0, 1); + CHECK_STATUS(status, NT_STATUS_OK); + ZERO_STRUCT(io2.smb2); io2.smb2.level = RAW_LOCK_SMB2; io2.smb2.in.file.handle = io.smb2.out.file.handle; io2.smb2.in.lock_count = 1; + ZERO_STRUCT(lock); lock[0].offset = 0; + lock[0].length = 1; lock[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE | SMB2_LOCK_FLAG_FAIL_IMMEDIATELY; io2.smb2.in.locks = &lock[0]; -- cgit