From: Volker Lendecke Date: Tue, 2 Sep 2025 10:35:04 +0000 (+0200) Subject: vfs: Pass streams_xattr_config to get_xattr_size_fsp() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7eab744617871ce6a1c0dbd1f99f361f905e7e0e;p=thirdparty%2Fsamba.git vfs: Pass streams_xattr_config to get_xattr_size_fsp() To be used in later patches Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index d12af97122d..8473f5133de 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -121,7 +121,8 @@ again: return 0; } -static ssize_t get_xattr_size_fsp(struct files_struct *fsp, +static ssize_t get_xattr_size_fsp(const struct streams_xattr_config *config, + struct files_struct *fsp, const char *xattr_name) { int ret; @@ -252,10 +253,16 @@ static bool streams_xattr_recheck(struct stream_io *sio) static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { + struct streams_xattr_config *config = NULL; int ret = -1; struct stream_io *io = (struct stream_io *) VFS_FETCH_FSP_EXTENSION(handle, fsp); + SMB_VFS_HANDLE_GET_DATA(handle, + config, + struct streams_xattr_config, + return -1); + if (io == NULL || !fsp_is_alternate_stream(fsp)) { return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); } @@ -271,7 +278,8 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, return -1; } - sbuf->st_ex_size = get_xattr_size_fsp(fsp->base_fsp, + sbuf->st_ex_size = get_xattr_size_fsp(config, + fsp->base_fsp, io->xattr_name); if (sbuf->st_ex_size == -1) { SET_STAT_INVALID(*sbuf); @@ -292,6 +300,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, static int streams_xattr_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname) { + struct streams_xattr_config *config = NULL; NTSTATUS status; int ret; int result = -1; @@ -300,6 +309,11 @@ static int streams_xattr_stat(vfs_handle_struct *handle, struct smb_filename *pathref = NULL; struct files_struct *fsp = smb_fname->fsp; + SMB_VFS_HANDLE_GET_DATA(handle, + config, + struct streams_xattr_config, + return -1); + if (!is_named_stream(smb_fname)) { return SMB_VFS_NEXT_STAT(handle, smb_fname); } @@ -350,8 +364,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle, fsp = fsp->base_fsp; } - smb_fname->st.st_ex_size = get_xattr_size_fsp(fsp, - xattr_name); + smb_fname->st.st_ex_size = get_xattr_size_fsp(config, fsp, xattr_name); if (smb_fname->st.st_ex_size == -1) { TALLOC_FREE(xattr_name); TALLOC_FREE(pathref); @@ -394,6 +407,7 @@ static int streams_xattr_fstatat(struct vfs_handle_struct *handle, SMB_STRUCT_STAT *sbuf, int flags) { + struct streams_xattr_config *config = NULL; char *xattr_name = NULL; struct smb_filename *pathref = NULL; struct files_struct *fsp = smb_fname->fsp; @@ -401,6 +415,11 @@ static int streams_xattr_fstatat(struct vfs_handle_struct *handle, NTSTATUS status; int ret = -1; + SMB_VFS_HANDLE_GET_DATA(handle, + config, + struct streams_xattr_config, + return -1); + DBG_DEBUG("called for [%s/%s]\n", dirfsp->fsp_name->base_name, smb_fname_str_dbg(smb_fname)); @@ -444,7 +463,7 @@ static int streams_xattr_fstatat(struct vfs_handle_struct *handle, *sbuf = fsp->fsp_name->st; - size = get_xattr_size_fsp(fsp, xattr_name); + size = get_xattr_size_fsp(config, fsp, xattr_name); if (size == -1) { errno = ENOENT; ret = -1;