From: Noel Power Date: Wed, 10 Feb 2021 09:53:23 +0000 (+0000) Subject: s3/smbd: Create new file get_ea_list_from_fsp_new (not used) X-Git-Tag: tevent-0.11.0~1709 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=341abce363ba328ca828d7d614497dbdfd7af272;p=thirdparty%2Fsamba.git s3/smbd: Create new file get_ea_list_from_fsp_new (not used) On the way to removing get_ea_list_from_file_path and replacing it with get_ea_list_from_fsp create a copy of get_ea_list_from_file_path called get_ea_list_from_fsp_new. It is ifdef'ed out for the moment as it isn't used yet Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index e50785e7a5a..5d05a8490c7 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -526,6 +526,121 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } + +#if 0 +/**************************************************************************** + Return a linked list of the total EA's. Plus the total size +****************************************************************************/ + +static NTSTATUS get_ea_list_from_fsp_new(TALLOC_CTX *mem_ctx, + files_struct *fsp, + size_t *pea_total_len, + struct ea_list **ea_list) +{ + /* Get a list of all xattrs. Max namesize is 64k. */ + size_t i, num_names; + char **names; + struct ea_list *ea_list_head = NULL; + bool posix_pathnames = false; + NTSTATUS status; + + *pea_total_len = 0; + *ea_list = NULL; + + /* symlink */ + if (fsp == NULL) { + return NT_STATUS_OK; + } + + if (!lp_ea_support(SNUM(fsp->conn))) { + return NT_STATUS_OK; + } + + posix_pathnames = (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH); + + status = get_ea_names_from_file(talloc_tos(), + fsp->conn, + fsp, + &names, + &num_names); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (num_names == 0) { + return NT_STATUS_OK; + } + + for (i=0; iconn, + fsp, + fsp->fsp_name, + names[i], + &listp->ea); + + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(listp); + return status; + } + + if (listp->ea.value.length == 0) { + /* + * We can never return a zero length EA. + * Windows reports the EA's as corrupted. + */ + TALLOC_FREE(listp); + continue; + } + + push_ascii_fstring(dos_ea_name, listp->ea.name); + + *pea_total_len += + 4 + strlen(dos_ea_name) + 1 + listp->ea.value.length; + + DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len " + "= %u\n", (unsigned int)*pea_total_len, dos_ea_name, + (unsigned int)listp->ea.value.length)); + + DLIST_ADD_END(ea_list_head, listp); + + } + + /* Add on 4 for total length. */ + if (*pea_total_len) { + *pea_total_len += 4; + } + + DEBUG(10, ("get_ea_list_from_file: total_len = %u\n", + (unsigned int)*pea_total_len)); + + *ea_list = ea_list_head; + return NT_STATUS_OK; +} +#endif + static NTSTATUS get_ea_list_from_fsp(TALLOC_CTX *mem_ctx, files_struct *fsp, size_t *pea_total_len,