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

s3/smbd: use smb_fname->fsp for get_ea_list_from_file_path in estimate_ea_size()

Additionally ensure get_ea_list_from_file_path is called with base file.

Previously fsp was set to NULL if fsp pointed to a ntfs stream which in
turn ensured that 'base_path' from the smb_fname was used (which points
to the base file). Now we get a pathref fsp (pointing to the base file)
instead

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Noel Power 2021-01-29 14:54:47 +00:00 committed by Jeremy Allison
parent dfc80b4ce8
commit 5cbab2ebfd

View File

@ -681,6 +681,7 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp,
size_t total_ea_len = 0;
TALLOC_CTX *mem_ctx;
struct ea_list *ea_list = NULL;
NTSTATUS status;
if (!lp_ea_support(SNUM(conn))) {
return 0;
@ -692,16 +693,34 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp,
* (streams cannot have EAs), but the estimate isn't just 0 in
* this case! */
if (is_ntfs_stream_smb_fname(smb_fname)) {
fsp = NULL;
}
(void)get_ea_list_from_file_path(mem_ctx,
struct smb_filename *pathref = NULL;
status = synthetic_pathref(mem_ctx,
conn->cwd_fsp,
smb_fname->base_name,
NULL,
NULL,
smb_fname->twrp,
smb_fname->flags,
&pathref);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(mem_ctx);
return 0;
}
(void)get_ea_list_from_file_path(mem_ctx,
conn,
fsp,
pathref->fsp,
pathref,
&total_ea_len,
&ea_list);
} else {
(void)get_ea_list_from_file_path(mem_ctx,
conn,
smb_fname->fsp,
smb_fname,
&total_ea_len,
&ea_list);
}
if(conn->sconn->using_smb2) {
NTSTATUS status;
unsigned int ret_data_size;
/*
* We're going to be using fill_ea_chained_buffer() to