/* close a search */ static NTSTATUS cvfs_search_close(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_close *io) { struct cvfs_private *p = ntvfs->private_data; SETUP_PID; return smb_raw_search_close(p->tree, io); }
/* do a single file (non-wildcard) search */ NTSTATUS torture_single_search(struct smbcli_state *cli, TALLOC_CTX *tctx, const char *pattern, enum smb_search_level level, enum smb_search_data_level data_level, uint16_t attrib, union smb_search_data *data) { union smb_search_first io; union smb_search_close c; NTSTATUS status; switch (level) { case RAW_SEARCH_SEARCH: case RAW_SEARCH_FFIRST: case RAW_SEARCH_FUNIQUE: io.search_first.level = level; io.search_first.data_level = RAW_SEARCH_DATA_SEARCH; io.search_first.in.max_count = 1; io.search_first.in.search_attrib = attrib; io.search_first.in.pattern = pattern; break; case RAW_SEARCH_TRANS2: io.t2ffirst.level = RAW_SEARCH_TRANS2; io.t2ffirst.data_level = data_level; io.t2ffirst.in.search_attrib = attrib; io.t2ffirst.in.max_count = 1; io.t2ffirst.in.flags = FLAG_TRANS2_FIND_CLOSE; io.t2ffirst.in.storage_type = 0; io.t2ffirst.in.pattern = pattern; break; case RAW_SEARCH_SMB2: return NT_STATUS_INVALID_LEVEL; } status = smb_raw_search_first(cli->tree, tctx, &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; }