diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-03-13 10:00:57 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-03-13 10:00:57 +1100 |
commit | 3d9056aa863c8e1307709bcbbdbd3305e9bfe62f (patch) | |
tree | 49224fa1f8e5bc488e01f709015ed37be9b9d898 /source4/torture/raw/oplock.c | |
parent | 07a7c8fa0d76cb7cb10cc88fb5bbe5439b746d01 (diff) | |
parent | 50243cdbbda8a1f14e56c684281a93614aab0103 (diff) | |
download | samba-3d9056aa863c8e1307709bcbbdbd3305e9bfe62f.tar.gz samba-3d9056aa863c8e1307709bcbbdbd3305e9bfe62f.tar.bz2 samba-3d9056aa863c8e1307709bcbbdbd3305e9bfe62f.zip |
Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
(This used to be commit e9567e39106efb7443ed2c5df3492208b1c1d766)
Diffstat (limited to 'source4/torture/raw/oplock.c')
-rw-r--r-- | source4/torture/raw/oplock.c | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 89f3607ecd..5ab43d5e78 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -2218,7 +2218,7 @@ bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1) NTSTATUS status; bool ret = true; union smb_open io; - union smb_fileinfo qfi; + union smb_fileinfo qfi, qpi; union smb_rename rn; uint16_t fnum=0; @@ -2237,7 +2237,7 @@ bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1) */ io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.root_fid = 0; - io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; + io.ntcreatex.in.access_mask = 0;/* ask for no access at all */; io.ntcreatex.in.alloc_size = 0; io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE; @@ -2256,7 +2256,7 @@ bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1) fnum = io.ntcreatex.out.file.fnum; CHECK_VAL(io.ntcreatex.out.oplock_level, EXCLUSIVE_OPLOCK_RETURN); - torture_comment(tctx, "nttrans_rename should not trigger a break nor a share mode violation\n"); + torture_comment(tctx, "nttrans_rename: should not trigger a break nor a share mode violation\n"); ZERO_STRUCT(rn); rn.generic.level = RAW_RENAME_NTTRANS; rn.nttrans.in.file.fnum = fnum; @@ -2268,25 +2268,60 @@ bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1) CHECK_STATUS(tctx, status, NT_STATUS_OK); CHECK_VAL(break_info.count, 0); - /* Seems name is only updated on close. */ - smbcli_close(cli1->tree, fnum); - - /* Check if we can open with the new name. */ - io.ntcreatex.in.fname = fname2; - status = smb_raw_open(cli1->tree, tctx, &io); - CHECK_STATUS(tctx, status, NT_STATUS_OK); - fnum = io.ntcreatex.out.file.fnum; - CHECK_VAL(io.ntcreatex.out.oplock_level, EXCLUSIVE_OPLOCK_RETURN); - + /* w2k3 does nothing, it doesn't rename the file */ + torture_comment(tctx, "nttrans_rename: the server should have done nothing\n"); ZERO_STRUCT(qfi); qfi.generic.level = RAW_FILEINFO_ALL_INFORMATION; qfi.generic.in.file.fnum = fnum; status = smb_raw_fileinfo(cli1->tree, tctx, &qfi); CHECK_STATUS(tctx, status, NT_STATUS_OK); - CHECK_STRMATCH(qfi.all_info.out.fname.s, fname2); + CHECK_STRMATCH(qfi.all_info.out.fname.s, fname1); - smbcli_close(cli1->tree, fnum); + ZERO_STRUCT(qpi); + qpi.generic.level = RAW_FILEINFO_ALL_INFORMATION; + qpi.generic.in.file.path = fname1; + + status = smb_raw_pathinfo(cli1->tree, tctx, &qpi); + CHECK_STATUS(tctx, status, NT_STATUS_OK); + CHECK_STRMATCH(qpi.all_info.out.fname.s, fname1); + + ZERO_STRUCT(qpi); + qpi.generic.level = RAW_FILEINFO_ALL_INFORMATION; + qpi.generic.in.file.path = fname2; + + status = smb_raw_pathinfo(cli1->tree, tctx, &qpi); + CHECK_STATUS(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + + torture_comment(tctx, "nttrans_rename: after closing the file the file is still not renamed\n"); + status = smbcli_close(cli1->tree, fnum); + CHECK_STATUS(tctx, status, NT_STATUS_OK); + + ZERO_STRUCT(qpi); + qpi.generic.level = RAW_FILEINFO_ALL_INFORMATION; + qpi.generic.in.file.path = fname1; + + status = smb_raw_pathinfo(cli1->tree, tctx, &qpi); + CHECK_STATUS(tctx, status, NT_STATUS_OK); + CHECK_STRMATCH(qpi.all_info.out.fname.s, fname1); + + ZERO_STRUCT(qpi); + qpi.generic.level = RAW_FILEINFO_ALL_INFORMATION; + qpi.generic.in.file.path = fname2; + + status = smb_raw_pathinfo(cli1->tree, tctx, &qpi); + CHECK_STATUS(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + + torture_comment(tctx, "nttrans_rename: rename with an invalid handle gives NT_STATUS_INVALID_HANDLE\n"); + ZERO_STRUCT(rn); + rn.generic.level = RAW_RENAME_NTTRANS; + rn.nttrans.in.file.fnum = fnum+1; + rn.nttrans.in.flags = 0; + rn.nttrans.in.new_name = fname2+strlen(BASEDIR)+1; + + status = smb_raw_rename(cli1->tree, &rn); + + CHECK_STATUS(tctx, status, NT_STATUS_INVALID_HANDLE); done: smb_raw_exit(cli1->session); |