1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

smbd: let smbd_dirptr_lanman2_entry return smb_fname

Note that smb_fname is relative to fsp, not conn!

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2018-03-15 19:03:59 +01:00
parent 00a26ac985
commit 8884036ba2
3 changed files with 24 additions and 3 deletions

View File

@ -210,6 +210,7 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
char *base_data,
char *end_data,
int space_remaining,
struct smb_filename **smb_fname,
bool *got_exact_match,
int *_last_entry_off,
struct ea_list *name_list,

View File

@ -531,6 +531,7 @@ static bool smb2_query_directory_next_entry(struct tevent_req *req)
{
struct smbd_smb2_query_directory_state *state = tevent_req_data(
req, struct smbd_smb2_query_directory_state);
struct smb_filename *smb_fname = NULL; /* relative to fsp !! */
bool got_exact_match = false;
int off = state->out_output_buffer.length;
int space_remaining = state->in_output_buffer_length - off;
@ -557,6 +558,7 @@ static bool smb2_query_directory_next_entry(struct tevent_req *req)
state->base_data,
state->end_data,
space_remaining,
&smb_fname,
&got_exact_match,
&state->last_entry_off,
NULL,
@ -603,6 +605,8 @@ static bool smb2_query_directory_next_entry(struct tevent_req *req)
state->async_sharemode_count++;
}
TALLOC_FREE(smb_fname);
state->num++;
state->out_output_buffer.length = off;

View File

@ -2458,6 +2458,7 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
char *base_data,
char *end_data,
int space_remaining,
struct smb_filename **_smb_fname,
bool *got_exact_match,
int *_last_entry_off,
struct ea_list *name_list,
@ -2548,15 +2549,29 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
*file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
}
TALLOC_FREE(fname);
TALLOC_FREE(smb_fname);
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES))
{
TALLOC_FREE(smb_fname);
TALLOC_FREE(fname);
return status;
}
if (_smb_fname != NULL) {
struct smb_filename *name = NULL;
name = synthetic_smb_fname(ctx, fname, NULL, &smb_fname->st, 0);
if (name == NULL) {
TALLOC_FREE(smb_fname);
TALLOC_FREE(fname);
return NT_STATUS_NO_MEMORY;
}
*_smb_fname = name;
}
TALLOC_FREE(smb_fname);
TALLOC_FREE(fname);
if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
dptr_SeekDir(dirptr, prev_dirpos);
return status;
@ -2598,6 +2613,7 @@ static NTSTATUS get_lanman2_dir_entry(TALLOC_CTX *ctx,
true, align, do_pad,
ppdata, base_data, end_data,
space_remaining,
NULL,
got_exact_match,
last_entry_off, name_list, NULL);
}