>From 9ea8ad10f18819fcc6ed7d3314c68cbb0febdff1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 8 Sep 2017 15:27:37 -0700 Subject: [PATCH 1/2] s3: VFS: streams_xattr: Compression is only set/get on base filenames. Can be ignored (pass-through) in streams_xattr VFS module. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13003 Signed-off-by: Jeremy Allison --- source3/modules/vfs_streams_xattr.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index bd3965c0e90..1b0b577e097 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -1653,40 +1653,6 @@ static bool streams_xattr_strict_lock_check(struct vfs_handle_struct *handle, return true; } -static NTSTATUS streams_xattr_get_compression(struct vfs_handle_struct *handle, - TALLOC_CTX *mem_ctx, - struct files_struct *fsp, - struct smb_filename *smb_fname, - uint16_t *_compression_fmt) -{ - struct stream_io *sio = - (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); - - if (sio == NULL) { - return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, - smb_fname, _compression_fmt); - } - - *_compression_fmt = COMPRESSION_FORMAT_NONE; - return NT_STATUS_OK; -} - -static NTSTATUS streams_xattr_set_compression(struct vfs_handle_struct *handle, - TALLOC_CTX *mem_ctx, - struct files_struct *fsp, - uint16_t compression_fmt) -{ - struct stream_io *sio = - (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); - - if (sio == NULL) { - return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp, - compression_fmt); - } - - return NT_STATUS_NOT_SUPPORTED; -} - static struct vfs_fn_pointers vfs_streams_xattr_fns = { .fs_capabilities_fn = streams_xattr_fs_capabilities, .connect_fn = streams_xattr_connect, @@ -1715,9 +1681,6 @@ static struct vfs_fn_pointers vfs_streams_xattr_fns = { .linux_setlease_fn = streams_xattr_linux_setlease, .strict_lock_check_fn = streams_xattr_strict_lock_check, - .get_compression_fn = streams_xattr_get_compression, - .set_compression_fn = streams_xattr_set_compression, - .fchown_fn = streams_xattr_fchown, .fchmod_fn = streams_xattr_fchmod, .fsync_fn = streams_xattr_fsync, -- 2.14.1.581.gf28d330327-goog >From 9d2cacbb347b83bc35dce9ae761a3f23ac22ee07 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 8 Sep 2017 15:28:39 -0700 Subject: [PATCH 2/2] s3: vfs: catia: compression get/set must act only on base file, and must cope with fsp==NULL. Correctly do filename conversion. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13003 Signed-off-by: Jeremy Allison --- source3/modules/vfs_catia.c | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 5cf7476b4b2..c47b64d8657 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -2435,16 +2435,48 @@ static NTSTATUS catia_get_compression(vfs_handle_struct *handle, NTSTATUS result; struct catia_cache *cc = NULL; int ret; + struct smb_filename *mapped_smb_fname = NULL; + char *mapped_name = NULL; - ret = CATIA_FETCH_FSP_PRE_NEXT(talloc_tos(), handle, fsp, &cc); - if (ret != 0) { - return map_nt_error_from_unix(errno); + if (fsp != NULL) { + ret = CATIA_FETCH_FSP_PRE_NEXT(talloc_tos(), handle, fsp, &cc); + if (ret != 0) { + return map_nt_error_from_unix(errno); + } + mapped_smb_fname = fsp->fsp_name; + } else { + result = catia_string_replace_allocate(handle->conn, + smb_fname->base_name, + &mapped_name, + vfs_translate_to_unix); + if (!NT_STATUS_IS_OK(result)) { + return result; + } + + mapped_smb_fname = synthetic_smb_fname(talloc_tos(), + mapped_name, + NULL, + NULL, + smb_fname->flags); + if (mapped_smb_fname == NULL) { + TALLOC_FREE(mapped_name); + return NT_STATUS_NO_MEMORY; + } + + TALLOC_FREE(mapped_name); } - result = SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname, - _compression_fmt); + result = SMB_VFS_NEXT_GET_COMPRESSION(handle, + mem_ctx, + fsp, + mapped_smb_fname, + _compression_fmt); - CATIA_FETCH_FSP_POST_NEXT(&cc, fsp); + if (fsp != NULL) { + CATIA_FETCH_FSP_POST_NEXT(&cc, fsp); + } else { + TALLOC_FREE(mapped_smb_fname); + } return result; } -- 2.14.1.581.gf28d330327-goog