1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

smbd: remove coupling between get_ea_names_from_file() and "ea support"

The "ea support" configuration variable determines whether smbd
should attempt to manipulate extended attributes via SMB protocol.
It does not pertain to the underlying storage and its support for
extended attributes.

get_ea_names_from_file() is being used also by vfs_streams_xattr -
a module which has nothing to do with client-visible extended
attributes. As such, vfs_streams_xattr should be able to operate
irrespective of the value of "ea support".

This patch moves the check for ea support to the callers.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Uri Simchoni 2017-03-02 08:39:56 +02:00 committed by Ralph Boehme
parent fb95985a03
commit 4bfd27b077
2 changed files with 22 additions and 16 deletions

View File

@ -688,16 +688,19 @@ void reply_ntcreate_and_X(struct smb_request *req)
p += 8;
if (flags & EXTENDED_RESPONSE_REQUIRED) {
uint16_t file_status = (NO_EAS|NO_SUBSTREAMS|NO_REPARSETAG);
size_t num_names = 0;
unsigned int num_streams = 0;
struct stream_struct *streams = NULL;
/* Do we have any EA's ? */
status = get_ea_names_from_file(ctx, conn, fsp,
smb_fname, NULL, &num_names);
if (NT_STATUS_IS_OK(status) && num_names) {
file_status &= ~NO_EAS;
if (lp_ea_support(SNUM(conn))) {
size_t num_names = 0;
/* Do we have any EA's ? */
status = get_ea_names_from_file(
ctx, conn, fsp, smb_fname, NULL, &num_names);
if (NT_STATUS_IS_OK(status) && num_names) {
file_status &= ~NO_EAS;
}
}
status = vfs_streaminfo(conn, NULL, smb_fname, ctx,
&num_streams, &streams);
/* There is always one stream, ::$DATA. */
@ -1334,16 +1337,19 @@ static void call_nt_transact_create(connection_struct *conn,
p += 8;
if (flags & EXTENDED_RESPONSE_REQUIRED) {
uint16_t file_status = (NO_EAS|NO_SUBSTREAMS|NO_REPARSETAG);
size_t num_names = 0;
unsigned int num_streams = 0;
struct stream_struct *streams = NULL;
/* Do we have any EA's ? */
status = get_ea_names_from_file(ctx, conn, fsp,
smb_fname, NULL, &num_names);
if (NT_STATUS_IS_OK(status) && num_names) {
file_status &= ~NO_EAS;
if (lp_ea_support(SNUM(conn))) {
size_t num_names = 0;
/* Do we have any EA's ? */
status = get_ea_names_from_file(
ctx, conn, fsp, smb_fname, NULL, &num_names);
if (NT_STATUS_IS_OK(status) && num_names) {
file_status &= ~NO_EAS;
}
}
status = vfs_streaminfo(conn, NULL, smb_fname, ctx,
&num_streams, &streams);
/* There is always one stream, ::$DATA. */

View File

@ -262,10 +262,6 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx,
}
*pnum_names = 0;
if (!lp_ea_support(SNUM(conn))) {
return NT_STATUS_OK;
}
status = refuse_symlink(conn, fsp, smb_fname);
if (!NT_STATUS_IS_OK(status)) {
/*
@ -397,6 +393,10 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx,
*pea_total_len = 0;
*ea_list = NULL;
if (!lp_ea_support(SNUM(conn))) {
return NT_STATUS_OK;
}
if (fsp) {
posix_pathnames =
(fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);