s4-torture: fixed error code for s4 in SMB2-LOCK test
authorAndrew Tridgell <tridge@samba.org>
Fri, 27 Nov 2009 08:10:50 +0000 (19:10 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 27 Nov 2009 08:42:11 +0000 (19:42 +1100)
s4 returns NETWORK_NAME_DELETED if you attempt to use an invalid tree connection
for a lock. This test (correctly I think) happens before we validate the file handle.
That implies that when you pass both a closed handle and a invalid tree you
should get NT_STATUS_NETWORK_NAME_DELETED.

source4/torture/smb2/lock.c

index e3473ece2b4e62ce3b6cf6816652ac2be18f6434..95b825e83e729e7d5f7428cfc917f7e8d874ea6a 100644 (file)
@@ -1056,7 +1056,14 @@ static bool test_cancel_tdis(struct torture_context *torture,
        lck.in.file.handle      = h;
        el[0].flags             = SMB2_LOCK_FLAG_UNLOCK;
        status = smb2_lock(tree, &lck);
-       CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+       if (torture_setting_bool(torture, "samba4", false)) {
+               /* checking if the tcon supplied are still valid
+                * should happen before you validate a file handle,
+                * so we should return USER_SESSION_DELETED */
+               CHECK_STATUS(status, NT_STATUS_NETWORK_NAME_DELETED);
+       } else {
+               CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+       }
 
 done:
        smb2_util_close(tree, h2);