summaryrefslogtreecommitdiff
path: root/source4/torture/raw/rename.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-13 05:47:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:46 -0500
commit1c59d825afc3cdfe2ea42821123ece934ad7b5e0 (patch)
tree43eeda9448035f46ebbd8fcbb881a876d7fcba81 /source4/torture/raw/rename.c
parent1158268287f07310e79e9d470971dc021a334f9e (diff)
downloadsamba-1c59d825afc3cdfe2ea42821123ece934ad7b5e0.tar.gz
samba-1c59d825afc3cdfe2ea42821123ece934ad7b5e0.tar.bz2
samba-1c59d825afc3cdfe2ea42821123ece934ad7b5e0.zip
r3717: - expanded the RAW-RENAME test a little
- added support for wildcard rename in pvfs - made more consistent use of pvfs_map_errno() (This used to be commit e255d1c3a811c480a850452aaf636d9fa36f69fe)
Diffstat (limited to 'source4/torture/raw/rename.c')
-rw-r--r--source4/torture/raw/rename.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 68bd2eda2d..c3fc739d6a 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -48,6 +48,7 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
int fnum;
const char *fname1 = BASEDIR "\\test1.txt";
const char *fname2 = BASEDIR "\\test2.txt";
+ union smb_open op;
printf("Testing SMBmv\n");
@@ -57,16 +58,58 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying simple rename\n");
- fnum = create_complex_file(cli, mem_ctx, fname1);
-
+ op.generic.level = RAW_OPEN_NTCREATEX;
+ op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.flags = 0;
+ op.ntcreatex.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED;
+ op.ntcreatex.in.create_options = 0;
+ op.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ op.ntcreatex.in.share_access =
+ NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ op.ntcreatex.in.alloc_size = 0;
+ op.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+ op.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ op.ntcreatex.in.security_flags = 0;
+ op.ntcreatex.in.fname = fname1;
+
+ status = smb_raw_open(cli->tree, mem_ctx, &op);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = op.ntcreatex.out.fnum;
+
io.generic.level = RAW_RENAME_RENAME;
io.rename.in.pattern1 = fname1;
io.rename.in.pattern2 = fname2;
io.rename.in.attrib = 0;
+ printf("trying rename while first file open\n");
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
-
+
+ smbcli_close(cli->tree, fnum);
+
+ op.ntcreatex.in.access_mask = GENERIC_RIGHTS_FILE_READ;
+ op.ntcreatex.in.share_access =
+ NTCREATEX_SHARE_ACCESS_DELETE |
+ NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ status = smb_raw_open(cli->tree, mem_ctx, &op);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = op.ntcreatex.out.fnum;
+
+ printf("trying rename while first file open with SHARE_ACCESS_DELETE\n");
+ status = smb_raw_rename(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ io.rename.in.pattern1 = fname2;
+ io.rename.in.pattern2 = fname1;
+ status = smb_raw_rename(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ io.rename.in.pattern1 = fname1;
+ io.rename.in.pattern2 = fname2;
+
+ printf("trying rename while not open\n");
smb_raw_exit(cli->session);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);