diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-09-23 15:33:36 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-09-25 10:38:44 -0700 |
commit | ca847b593d83f7ce09473469bd79531fdc8d0359 (patch) | |
tree | 431cdb8de5bb7413521b05c70bf098d062d66150 /source4/torture/smb2 | |
parent | 99f0891944e8df91b98934b6c57f9c68dfed8722 (diff) | |
download | samba-ca847b593d83f7ce09473469bd79531fdc8d0359.tar.gz samba-ca847b593d83f7ce09473469bd79531fdc8d0359.tar.bz2 samba-ca847b593d83f7ce09473469bd79531fdc8d0359.zip |
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
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r-- | source4/torture/smb2/create.c | 6 |
1 files changed, 6 insertions, 0 deletions
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]; |