summaryrefslogtreecommitdiff
path: root/source4/smb_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-06 08:00:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:49 -0500
commitaf0a9eb52955cfae570bfdc01821f56385c860cf (patch)
tree9a798fd727753c3d9ceb44512579dc5b3e7fbebf /source4/smb_server
parent51e0ae33acf3cd09ae0eb9ef5077cecab4780a3e (diff)
downloadsamba-af0a9eb52955cfae570bfdc01821f56385c860cf.tar.gz
samba-af0a9eb52955cfae570bfdc01821f56385c860cf.tar.bz2
samba-af0a9eb52955cfae570bfdc01821f56385c860cf.zip
r16834: split the level's of smb_search_first/smb_search_next and the levels
of smb_search_data metze (This used to be commit 78c201db8a47a71908698c4dda2add4cf85694d9)
Diffstat (limited to 'source4/smb_server')
-rw-r--r--source4/smb_server/blob.c14
-rw-r--r--source4/smb_server/smb/search.c2
-rw-r--r--source4/smb_server/smb/trans2.c52
3 files changed, 36 insertions, 32 deletions
diff --git a/source4/smb_server/blob.c b/source4/smb_server/blob.c
index 07d1e0480d..a456e04b34 100644
--- a/source4/smb_server/blob.c
+++ b/source4/smb_server/blob.c
@@ -593,7 +593,7 @@ NTSTATUS smbsrv_pull_passthru_sfileinfo(TALLOC_CTX *mem_ctx,
*/
NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
DATA_BLOB *blob,
- enum smb_search_level level,
+ enum smb_search_data_level level,
union smb_search_data *file,
int default_str_flags)
{
@@ -601,7 +601,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
uint_t ofs = blob->length;
switch (level) {
- case RAW_SEARCH_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_DIRECTORY_INFO:
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, ofs + 64));
data = blob->data + ofs;
SIVAL(data, 4, file->directory_info.file_index);
@@ -619,7 +619,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
SIVAL(data, 0, blob->length - ofs);
return NT_STATUS_OK;
- case RAW_SEARCH_FULL_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_FULL_DIRECTORY_INFO:
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, ofs + 68));
data = blob->data + ofs;
SIVAL(data, 4, file->full_directory_info.file_index);
@@ -638,7 +638,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
SIVAL(data, 0, blob->length - ofs);
return NT_STATUS_OK;
- case RAW_SEARCH_NAME_INFO:
+ case RAW_SEARCH_DATA_NAME_INFO:
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, ofs + 12));
data = blob->data + ofs;
SIVAL(data, 4, file->name_info.file_index);
@@ -649,7 +649,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
SIVAL(data, 0, blob->length - ofs);
return NT_STATUS_OK;
- case RAW_SEARCH_BOTH_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO:
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, ofs + 94));
data = blob->data + ofs;
SIVAL(data, 4, file->both_directory_info.file_index);
@@ -679,7 +679,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
SIVAL(data, 0, blob->length - ofs);
return NT_STATUS_OK;
- case RAW_SEARCH_ID_FULL_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO:
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, ofs + 80));
data = blob->data + ofs;
SIVAL(data, 4, file->id_full_directory_info.file_index);
@@ -700,7 +700,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx,
SIVAL(data, 0, blob->length - ofs);
return NT_STATUS_OK;
- case RAW_SEARCH_ID_BOTH_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO:
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, ofs + 104));
data = blob->data + ofs;
SIVAL(data, 4, file->id_both_directory_info.file_index);
diff --git a/source4/smb_server/smb/search.c b/source4/smb_server/smb/search.c
index b86c0ddb7e..cc6d866ac7 100644
--- a/source4/smb_server/smb/search.c
+++ b/source4/smb_server/smb/search.c
@@ -185,6 +185,7 @@ void smbsrv_reply_search(struct smbsrv_request *req)
sn->search_next.in.id.client_cookie = IVAL(p, 17);
sn->search_next.level = level;
+ sn->search_next.data_level = RAW_SEARCH_DATA_SEARCH;
sn->search_next.in.max_count = SVAL(req->in.vwv, VWV(0));
sn->search_next.in.search_attrib = SVAL(req->in.vwv, VWV(1));
@@ -195,6 +196,7 @@ void smbsrv_reply_search(struct smbsrv_request *req)
/* do a search first operation */
sf->search_first.level = level;
+ sf->search_first.data_level = RAW_SEARCH_DATA_SEARCH;
sf->search_first.in.search_attrib = SVAL(req->in.vwv, VWV(1));
sf->search_first.in.max_count = SVAL(req->in.vwv, VWV(0));
diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c
index a8fe9f165d..8a4abd8e60 100644
--- a/source4/smb_server/smb/trans2.c
+++ b/source4/smb_server/smb/trans2.c
@@ -682,7 +682,7 @@ static NTSTATUS trans2_setpathinfo(struct smbsrv_request *req, struct trans_op *
struct find_state {
struct trans_op *op;
void *search;
- enum smb_search_level level;
+ enum smb_search_data_level data_level;
uint16_t last_entry_offset;
uint16_t flags;
};
@@ -699,16 +699,13 @@ static NTSTATUS find_fill_info(struct find_state *state,
uint_t ofs = trans->out.data.length;
uint32_t ea_size;
- switch (state->level) {
- case RAW_SEARCH_SEARCH:
- case RAW_SEARCH_FFIRST:
- case RAW_SEARCH_FUNIQUE:
- case RAW_SEARCH_GENERIC:
- case RAW_SEARCH_SMB2:
+ switch (state->data_level) {
+ case RAW_SEARCH_DATA_GENERIC:
+ case RAW_SEARCH_DATA_SEARCH:
/* handled elsewhere */
return NT_STATUS_INVALID_LEVEL;
- case RAW_SEARCH_STANDARD:
+ case RAW_SEARCH_DATA_STANDARD:
if (state->flags & FLAG_TRANS2_FIND_REQUIRE_RESUME) {
TRANS2_CHECK(smbsrv_blob_grow_data(trans, &trans->out.data, ofs + 27));
SIVAL(trans->out.data.data, ofs, file->standard.resume_key);
@@ -728,7 +725,7 @@ static NTSTATUS find_fill_info(struct find_state *state,
STR_LEN8BIT | STR_TERMINATE | STR_LEN_NOTERM));
break;
- case RAW_SEARCH_EA_SIZE:
+ case RAW_SEARCH_DATA_EA_SIZE:
if (state->flags & FLAG_TRANS2_FIND_REQUIRE_RESUME) {
TRANS2_CHECK(smbsrv_blob_grow_data(trans, &trans->out.data, ofs + 31));
SIVAL(trans->out.data.data, ofs, file->ea_size.resume_key);
@@ -750,7 +747,7 @@ static NTSTATUS find_fill_info(struct find_state *state,
TRANS2_CHECK(smbsrv_blob_fill_data(trans, &trans->out.data, trans->out.data.length + 1));
break;
- case RAW_SEARCH_EA_LIST:
+ case RAW_SEARCH_DATA_EA_LIST:
ea_size = ea_list_size(file->ea_list.eas.num_eas, file->ea_list.eas.eas);
if (state->flags & FLAG_TRANS2_FIND_REQUIRE_RESUME) {
TRANS2_CHECK(smbsrv_blob_grow_data(trans, &trans->out.data, ofs + 27 + ea_size));
@@ -773,14 +770,17 @@ static NTSTATUS find_fill_info(struct find_state *state,
TRANS2_CHECK(smbsrv_blob_fill_data(trans, &trans->out.data, trans->out.data.length + 1));
break;
- case RAW_SEARCH_DIRECTORY_INFO:
- case RAW_SEARCH_FULL_DIRECTORY_INFO:
- case RAW_SEARCH_NAME_INFO:
- case RAW_SEARCH_BOTH_DIRECTORY_INFO:
- case RAW_SEARCH_ID_FULL_DIRECTORY_INFO:
- case RAW_SEARCH_ID_BOTH_DIRECTORY_INFO:
- return smbsrv_push_passthru_search(trans, &trans->out.data, state->level, file,
+ case RAW_SEARCH_DATA_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_FULL_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_NAME_INFO:
+ case RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_ID_FULL_DIRECTORY_INFO:
+ case RAW_SEARCH_DATA_ID_BOTH_DIRECTORY_INFO:
+ return smbsrv_push_passthru_search(trans, &trans->out.data, state->data_level, file,
SMBSRV_REQ_DEFAULT_STR_FLAGS(req));
+
+ case RAW_SEARCH_DATA_UNIX_INFO:
+ return NT_STATUS_INVALID_LEVEL;
}
return NT_STATUS_OK;
@@ -861,12 +861,13 @@ static NTSTATUS trans2_findfirst(struct smbsrv_request *req, struct trans_op *op
return NT_STATUS_FOOBAR;
}
- search->t2ffirst.level = (enum smb_search_level)level;
- if (search->t2ffirst.level >= RAW_SEARCH_GENERIC) {
+ search->t2ffirst.level = RAW_SEARCH_TRANS2;
+ search->t2ffirst.data_level = (enum smb_search_data_level)level;
+ if (search->t2ffirst.data_level >= RAW_SEARCH_DATA_GENERIC) {
return NT_STATUS_INVALID_LEVEL;
}
- if (search->t2ffirst.level == RAW_SEARCH_EA_LIST) {
+ if (search->t2ffirst.data_level == RAW_SEARCH_DATA_EA_LIST) {
TRANS2_CHECK(ea_pull_name_list(&trans->in.data, req,
&search->t2ffirst.in.num_names,
&search->t2ffirst.in.ea_names));
@@ -878,7 +879,7 @@ static NTSTATUS trans2_findfirst(struct smbsrv_request *req, struct trans_op *op
NT_STATUS_HAVE_NO_MEMORY(state);
state->op = op;
state->search = search;
- state->level = search->t2ffirst.level;
+ state->data_level = search->t2ffirst.data_level;
state->last_entry_offset= 0;
state->flags = search->t2ffirst.in.flags;
@@ -946,12 +947,13 @@ static NTSTATUS trans2_findnext(struct smbsrv_request *req, struct trans_op *op)
return NT_STATUS_FOOBAR;
}
- search->t2fnext.level = (enum smb_search_level)level;
- if (search->t2fnext.level >= RAW_SEARCH_GENERIC) {
+ search->t2fnext.level = RAW_SEARCH_TRANS2;
+ search->t2fnext.data_level = (enum smb_search_data_level)level;
+ if (search->t2fnext.data_level >= RAW_SEARCH_DATA_GENERIC) {
return NT_STATUS_INVALID_LEVEL;
}
- if (search->t2fnext.level == RAW_SEARCH_EA_LIST) {
+ if (search->t2fnext.data_level == RAW_SEARCH_DATA_EA_LIST) {
TRANS2_CHECK(ea_pull_name_list(&trans->in.data, req,
&search->t2fnext.in.num_names,
&search->t2fnext.in.ea_names));
@@ -962,7 +964,7 @@ static NTSTATUS trans2_findnext(struct smbsrv_request *req, struct trans_op *op)
NT_STATUS_HAVE_NO_MEMORY(state);
state->op = op;
state->search = search;
- state->level = search->t2fnext.level;
+ state->data_level = search->t2fnext.data_level;
state->last_entry_offset= 0;
state->flags = search->t2fnext.in.flags;