Bug 6637 - torture/smb2/lock.c should use valid lock flags in some places as defined in MS-SMB2
Summary: torture/smb2/lock.c should use valid lock flags in some places as defined in ...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: smbtorture (show other bugs)
Version: unspecified
Hardware: x64 Windows 7
: P3 normal (vote)
Target Milestone: ---
Assignee: Steven Danneman
QA Contact: samba4-qa@samba.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-13 20:16 UTC by Long Li
Modified: 2010-01-11 19:11 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Long Li 2009-08-13 20:16:52 UTC
There are some places in torture/smb2/lock.c that should use valid lock flags as defined in MS-SMB2

e.g.
@@ -82,7 +82,7 @@ static bool test_valid_request(struct torture_context *tor
        el[0].offset            = 0;
        el[0].length            = 0;
        el[0].reserved          = 0x00000000;
        el[0].flags             = SMB2_LOCK_FLAG_NONE;
        status = smb2_lock(tree, &lck);
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(lck.out.reserved, 0);

SMB2_LOCK_FLAG_NONE is not a valid flag and it will make server return INVALID_PARAMETER. Lock flags are described in MS-SMB2 2.2.26.1(http://msdn.microsoft.com/en-us/library/cc246538(PROT.10).aspx)

The same issue goes for line 187, 240, 261, 282, 283, 289, 309

test_lock_rw_none() should be removed or changed to use a valid flag.
Comment 1 Matthias Dieter Wallnöfer 2009-10-15 02:46:23 UTC
Add metze to CC list since he does some work on SMB(2) and torture.
Comment 2 Matthias Dieter Wallnöfer 2009-11-24 11:28:07 UTC
I still find a "SMB2_LOCK_FLAG_NONE" in the SMB2 lock test. Metze, would you like to work on this?
Comment 3 Matthias Dieter Wallnöfer 2009-12-22 04:08:07 UTC
Tim Prouty, since you have worked lately on s4 torture: would you like to fix this?
Comment 4 Steven Danneman 2010-01-11 15:26:07 UTC
I think I've already fixed this issue.  I'll take a look.
Comment 5 Steven Danneman 2010-01-11 19:11:29 UTC
The flags field was not properly validated in W2K8 when this test was first
written.  Since then the MS-SMB2 doc has been updated to clearly describe what
combination of flags are valid and which ones are not, and W2K8R2 follows this
spec.

The tests in SMB2-LOCK now explicitly give invalid flags only to see if the server will return STATUS_INVALID_PARAMETER.  In other tests, valid flags are
given.  The exception to this rule is if the server target is specified as
W2K8R2, in which case giving invalid flags is accepted by the server and a 
torture_warning() is raised.

Marking fixed.