summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-08-31 03:16:52 +0000
committerAndrew Tridgell <tridge@samba.org>2003-08-31 03:16:52 +0000
commit11c5869a450d5f78a9395889ec03f77732cc8be5 (patch)
treed3fd5854dd61dc36f3d83064fdf04dc34c81234e /source4/torture
parenta8a5ac2bd218d5bc3985ffbe118111c9b4649860 (diff)
downloadsamba-11c5869a450d5f78a9395889ec03f77732cc8be5.tar.gz
samba-11c5869a450d5f78a9395889ec03f77732cc8be5.tar.bz2
samba-11c5869a450d5f78a9395889ec03f77732cc8be5.zip
I think I've finally got the ascii/unicode issues right in trans2 find
first Also expanded the rename test a little (This used to be commit 723af7f097a8c7f23dac23039e479811559ac3cb)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/raw/rename.c47
-rw-r--r--source4/torture/raw/search.c42
2 files changed, 76 insertions, 13 deletions
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index b536b0fe1a..b997c2f310 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -155,7 +155,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.ntrename.in.old_name = fname1;
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
- io.ntrename.in.unknown = 0;
+ io.ntrename.in.cluster_size = 0;
io.ntrename.in.flags = RENAME_FLAG_RENAME;
status = smb_raw_rename(cli->tree, &io);
@@ -282,29 +282,54 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
io.ntrename.in.flags = RENAME_FLAG_RENAME;
- io.ntrename.in.unknown = 0xff;
+ io.ntrename.in.cluster_size = 0xff;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- fnum = create_directory_handle(cli, BASEDIR "\\testdir");
- printf("Trying flags 0x102 fnum=%d\n", fnum);
+ printf("Trying RENAME_FLAG_MOVE_CLUSTER_INFORMATION\n");
io.ntrename.in.old_name = fname2;
io.ntrename.in.new_name = fname1;
io.ntrename.in.attrib = 0;
- io.ntrename.in.flags = 0x102;
- io.ntrename.in.unknown = fnum;
+ io.ntrename.in.flags = RENAME_FLAG_MOVE_CLUSTER_INFORMATION;
+ io.ntrename.in.cluster_size = 1;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
- for (i=0;i<32;i++) {
- io.ntrename.in.unknown = (1<<i);
+ io.ntrename.in.flags = RENAME_FLAG_COPY;
+ status = smb_raw_rename(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+#if 0
+ {
+ char buf[16384];
+ fnum = cli_open(cli, fname1, O_RDWR, DENY_NONE);
+ memset(buf, 1, sizeof(buf));
+ cli_write(cli, fnum, 0, buf, 0, sizeof(buf));
+ cli_close(cli, fnum);
+
+ fnum = cli_open(cli, fname2, O_RDWR, DENY_NONE);
+ memset(buf, 1, sizeof(buf));
+ cli_write(cli, fnum, 0, buf, 0, sizeof(buf)-1);
+ cli_close(cli, fnum);
+
+ torture_all_info(cli->tree, fname1);
+ torture_all_info(cli->tree, fname2);
+ }
+
+
+ io.ntrename.in.flags = RENAME_FLAG_MOVE_CLUSTER_INFORMATION;
+ status = smb_raw_rename(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+
+ for (i=0;i<20000;i++) {
+ io.ntrename.in.cluster_size = i;
status = smb_raw_rename(cli->tree, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
- printf("i=0x%x status=%s\n", i, nt_errstr(status));
+ printf("i=%d status=%s\n", i, nt_errstr(status));
}
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
}
+#endif
printf("Checking other flags\n");
@@ -319,7 +344,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.ntrename.in.new_name = fname1;
io.ntrename.in.flags = i;
io.ntrename.in.attrib = 0;
- io.ntrename.in.unknown = 0;
+ io.ntrename.in.cluster_size = 0;
status = smb_raw_rename(cli->tree, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
printf("flags=0x%x status=%s\n", i, nt_errstr(status));
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index c9fa5d6a11..ab69b5af42 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -412,6 +412,12 @@ static NTSTATUS multiple_search(struct cli_state *cli,
if (level == RAW_SEARCH_STANDARD) {
io2.t2fnext.in.resume_key =
result->list[result->count-1].standard.resume_key;
+ } else if (level == RAW_SEARCH_EA_SIZE) {
+ io2.t2fnext.in.resume_key =
+ result->list[result->count-1].ea_size.resume_key;
+ } else if (level == RAW_SEARCH_DIRECTORY_INFO) {
+ io2.t2fnext.in.resume_key =
+ result->list[result->count-1].directory_info.file_index;
} else {
io2.t2fnext.in.resume_key =
result->list[result->count-1].both_directory_info.file_index;
@@ -423,6 +429,12 @@ static NTSTATUS multiple_search(struct cli_state *cli,
if (level == RAW_SEARCH_STANDARD) {
io2.t2fnext.in.last_name =
result->list[result->count-1].standard.name.s;
+ } else if (level == RAW_SEARCH_EA_SIZE) {
+ io2.t2fnext.in.last_name =
+ result->list[result->count-1].ea_size.name.s;
+ } else if (level == RAW_SEARCH_DIRECTORY_INFO) {
+ io2.t2fnext.in.last_name =
+ result->list[result->count-1].directory_info.name.s;
} else {
io2.t2fnext.in.last_name =
result->list[result->count-1].both_directory_info.name.s;
@@ -478,6 +490,16 @@ static int search_standard_compare(union smb_search_data *d1, union smb_search_d
return strcmp(d1->standard.name.s, d2->standard.name.s);
}
+static int search_ea_size_compare(union smb_search_data *d1, union smb_search_data *d2)
+{
+ return strcmp(d1->ea_size.name.s, d2->ea_size.name.s);
+}
+
+static int search_directory_info_compare(union smb_search_data *d1, union smb_search_data *d2)
+{
+ return strcmp(d1->directory_info.name.s, d2->directory_info.name.s);
+}
+
static int search_old_compare(union smb_search_data *d1, union smb_search_data *d2)
{
return strcmp(d1->search.name, d2->search.name);
@@ -507,6 +529,12 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
{"STANDARD", "FLAGS", RAW_SEARCH_STANDARD, CONT_FLAGS},
{"STANDARD", "KEY", RAW_SEARCH_STANDARD, CONT_RESUME_KEY},
{"STANDARD", "NAME", RAW_SEARCH_STANDARD, CONT_NAME},
+ {"EA_SIZE", "FLAGS", RAW_SEARCH_EA_SIZE, CONT_FLAGS},
+ {"EA_SIZE", "KEY", RAW_SEARCH_EA_SIZE, CONT_RESUME_KEY},
+ {"EA_SIZE", "NAME", RAW_SEARCH_EA_SIZE, CONT_NAME},
+ {"DIRECTORY_INFO", "FLAGS", RAW_SEARCH_DIRECTORY_INFO, CONT_FLAGS},
+ {"DIRECTORY_INFO", "KEY", RAW_SEARCH_DIRECTORY_INFO, CONT_RESUME_KEY},
+ {"DIRECTORY_INFO", "NAME", RAW_SEARCH_DIRECTORY_INFO, CONT_NAME},
{"SEARCH", "ID", RAW_SEARCH_SEARCH, CONT_RESUME_KEY}
};
@@ -519,7 +547,7 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Creating %d files\n", num_files);
for (i=0;i<num_files;i++) {
- asprintf(&fname, BASEDIR "\\test%03d.txt", i);
+ asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
fnum = cli_open(cli, fname, O_CREAT|O_RDWR, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
@@ -551,6 +579,12 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
} else if (search_types[t].level == RAW_SEARCH_STANDARD) {
qsort(result.list, result.count, sizeof(result.list[0]),
QSORT_CAST search_standard_compare);
+ } else if (search_types[t].level == RAW_SEARCH_EA_SIZE) {
+ qsort(result.list, result.count, sizeof(result.list[0]),
+ QSORT_CAST search_ea_size_compare);
+ } else if (search_types[t].level == RAW_SEARCH_DIRECTORY_INFO) {
+ qsort(result.list, result.count, sizeof(result.list[0]),
+ QSORT_CAST search_directory_info_compare);
} else {
qsort(result.list, result.count, sizeof(result.list[0]),
QSORT_CAST search_old_compare);
@@ -562,10 +596,14 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
s = result.list[i].both_directory_info.name.s;
} else if (search_types[t].level == RAW_SEARCH_STANDARD) {
s = result.list[i].standard.name.s;
+ } else if (search_types[t].level == RAW_SEARCH_EA_SIZE) {
+ s = result.list[i].ea_size.name.s;
+ } else if (search_types[t].level == RAW_SEARCH_DIRECTORY_INFO) {
+ s = result.list[i].directory_info.name.s;
} else {
s = result.list[i].search.name;
}
- asprintf(&fname, "test%03d.txt", i);
+ asprintf(&fname, "t%03d-%d.txt", i, i);
if (strcmp(fname, s)) {
printf("Incorrect name %s at entry %d\n", s, i);
ret = False;