From 23ba434b017d61f397befe9808fa3214c3964355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Sep 2004 08:46:47 +0000 Subject: r2469: complete overhaul of the old-style RAW_SEARCH_ calls (the OS/2 and original core level calls). The old code was completely wrong in many respects. also fixed the EA_SIZE level in the server extended the RAW-SEARCH test suite to test the new code properly (This used to be commit 71480271ad84b57fcdde264a54bb2408cf783255) --- source4/torture/raw/search.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source4/torture/raw/search.c') diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index d1619d9191..3a469b3a2d 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -45,10 +45,13 @@ static NTSTATUS single_search(struct smbcli_state *cli, union smb_search_data *data) { union smb_search_first io; + union smb_search_close c; NTSTATUS status; io.generic.level = level; - if (level == RAW_SEARCH_SEARCH) { + if (level == RAW_SEARCH_SEARCH || + level == RAW_SEARCH_FFIRST || + level == RAW_SEARCH_FUNIQUE) { io.search_first.in.max_count = 1; io.search_first.in.search_attrib = 0; io.search_first.in.pattern = pattern; @@ -62,6 +65,14 @@ static NTSTATUS single_search(struct smbcli_state *cli, status = smb_raw_search_first(cli->tree, mem_ctx, &io, (void *)data, single_search_callback); + + if (NT_STATUS_IS_OK(status) && level == RAW_SEARCH_FFIRST) { + c.fclose.level = RAW_FINDCLOSE_FCLOSE; + c.fclose.in.max_count = 1; + c.fclose.in.search_attrib = 0; + c.fclose.in.id = data->search.id; + status = smb_raw_search_close(cli->tree, &c); + } return status; } @@ -74,6 +85,8 @@ static struct { NTSTATUS status; union smb_search_data data; } levels[] = { + {"FFIRST", RAW_SEARCH_FFIRST, }, + {"FUNIQUE", RAW_SEARCH_FUNIQUE, }, {"SEARCH", RAW_SEARCH_SEARCH, }, {"STANDARD", RAW_SEARCH_STANDARD, }, {"EA_SIZE", RAW_SEARCH_EA_SIZE, }, @@ -151,7 +164,9 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) levels[i].level, &levels[i].data); expected_status = NT_STATUS_NO_SUCH_FILE; - if (levels[i].level == RAW_SEARCH_SEARCH) { + if (levels[i].level == RAW_SEARCH_SEARCH || + levels[i].level == RAW_SEARCH_FFIRST || + levels[i].level == RAW_SEARCH_FUNIQUE) { expected_status = STATUS_NO_MORE_FILES; } if (!NT_STATUS_EQUAL(status, expected_status)) { @@ -447,7 +462,7 @@ static NTSTATUS multiple_search(struct smbcli_state *cli, if (level == RAW_SEARCH_SEARCH) { io2.search_next.in.max_count = per_search; io2.search_next.in.search_attrib = 0; - io2.search_next.in.search_id = result->list[result->count-1].search.search_id; + io2.search_next.in.id = result->list[result->count-1].search.id; } else { io2.t2fnext.in.handle = io.t2ffirst.out.handle; io2.t2fnext.in.max_count = per_search; -- cgit