summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-12 15:10:57 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-12 15:13:28 +0100
commit23ab56cd80239bc7d31917cfca4488ef9f633992 (patch)
treec1dc64e11d11a77264cea8296138ca033325c06c /source4/torture/raw
parent2801b6a522c772cb4d53a7ab0349607ad20d3e64 (diff)
downloadsamba-23ab56cd80239bc7d31917cfca4488ef9f633992.tar.gz
samba-23ab56cd80239bc7d31917cfca4488ef9f633992.tar.bz2
samba-23ab56cd80239bc7d31917cfca4488ef9f633992.zip
RAW-RENAME: w2k3 just ignores a NTTRANS-RENAME!
metze (This used to be commit cd1b8efc5d8dc1eec03fe1bf1eb58dbded9584eb)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/oplock.c65
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);