The branch, master has been updated via 2458a20eaca s3: VFS: Update status of SMB_VFS_GETXATTR. via 99dd56c5fb5 vfs: RIP SMB_VFS_GETXATTR() via ce9cdeb3504 s3: VFS: xattr_tdb: Remove xattr_tdb_getxattr. via f91fbc2aedd s3: VFS: vxfs: Remove vxfs_get_xattr. via 1d3403fe218 s3: VFS: unityed_media: Remove um_getxattr. via 940aee8cb82 s3: VFS: snapper: Remove snapper_gmt_getxattr. via d46a293488d s3: VFS: shadow_copy2: Remove shadow_copy2_getxattr. via 6649e898497 s3: VFS: posix_eadb: Remove posix_eadb_getxattr. via e9417e61454 s3: VFS: media_harmony: Remove mh_getxattr. via 7c35fa34665 s3: VFS: glusterfs: Remove vfs_gluster_getxattr. via 2e4e26bb8f3 s3: VFS: ceph_snapshots: Remove ceph_snap_gmt_getxattr. via 3030f4799bc s3: VFS: ceph: Remove cephwrap_getxattr. via eafc108bcba s3: VFS: catia: Remove catia_getxattr. via 3996f11270d s3: VFS: cap: Remove cap_getxattr. via 27b8709cf91 s3: lib: adouble.c: In ad_read_meta() we can now guarantee a valid fsp. via 6a8d052f7c7 s3: VFS: fruit: In fruit_streaminfo_meta_netatalk(), ad_get() -> ad_get_meta_fsp(). via d05087d4b8e s3: VFS: fruit: In fruit_stat_meta_netatalk(), ad_get() -> ad_get_meta_fsp(). via 99a2a1be153 s3: VFS: fruit: In readdir_attr_meta_finderi_netatalk(), ad_get() -> ad_get_meta_fsp(). via 88f3ced4e0e s3: VFS: fruit: In update_btime(), ad_get() -> ad_get_meta_fsp(). via 18b49ad251f s3: VFS: fruit: Add helper function ad_get_meta_fsp(). via b2d6ed29061 s3: VFS: fruit: In the fruit handle->fruit_config_data, add a recursion guard we will set before calling openat_pathref_fsp(). via 342086d773c s3: VFS: fruit: In fruit_stat_meta_netatalk(), move the call to fruit_stat_base() before the ad_get() call. via 6eaf027458a s3: VFS: fruit: Inside fruit_open_meta_netatalk() change to use fsp->base_fsp->fsp_name in ad_get() instead of smb_fname. via 53e0494958d s3: lib: In ad_read_meta(), allow use of SMB_VFS_FGETXATTR() as well as SMB_VFS_GETXATTR(). via 6a366012aae s3: smbd: Fix fsp->base_fsp->fsp_name->fsp == fsp->base_fsp invarient in non_widelink_open(). via 4e97e33c3b7 s3: smbd: Code inside non_widelink_open() breaks an invarient inside the VFS. Demonstrate this. from edcb095c623 s3:libads: Remove extra new line in keytab list output
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 2458a20eacab4b02d3875df12bded2154293e92b Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 12:07:37 2021 -0700 s3: VFS: Update status of SMB_VFS_GETXATTR. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Sun Jul 4 18:01:16 UTC 2021 on sn-devel-184 commit 99dd56c5fb5922eed9ec3181fc5ea092833e6f39 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 23 12:06:19 2021 -0700 vfs: RIP SMB_VFS_GETXATTR() .--. .-, .-..-.__ .'(`.-` \_.-'-./` |\_( "\__ __.>\ '; _;---,._| / __/`'--) /.--. : |/' _.--.<| / | | _..-' `\ /' /` /_/ _/_/ >_.-``-. `Y /' _;---.`|/)))) '` .-''. \|: .' __, .-'"` .'--._ `-: \/: /' '.\ _|_ /.'`\ :; /' `- `-|-` -` | | | :.; : | .-'~^~`-. |: | .' _ _ `. |:. | | |_) | |_) | :. : | | | \ | | | : ; | | | : ; | | SMB_VFS | : ; | | GETXATTR | : ; | | | .jgs. : ; | | -."-/\\\/:::. `\."-._'."-"_\\-| |///."- " -."-.\\"-."//.-".`-."_\\-.".-\\`=.........=`//-". Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit ce9cdeb3504e007557a870ae99d3a84c8a7b9c36 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:07:29 2021 -0700 s3: VFS: xattr_tdb: Remove xattr_tdb_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit f91fbc2aedd9b646ca17bea7f211a467cdf275de Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:06:20 2021 -0700 s3: VFS: vxfs: Remove vxfs_get_xattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 1d3403fe2186110be52a720cebc7a5c3c9c1fe0f Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:05:23 2021 -0700 s3: VFS: unityed_media: Remove um_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 940aee8cb82367dc4f0e673bfe26544675e5f096 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:04:07 2021 -0700 s3: VFS: snapper: Remove snapper_gmt_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d46a293488d4abb98e9a18e73eb5d61b0af80150 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:03:09 2021 -0700 s3: VFS: shadow_copy2: Remove shadow_copy2_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 6649e898497ad0f9455284f21aa5691501121335 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:02:13 2021 -0700 s3: VFS: posix_eadb: Remove posix_eadb_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit e9417e614541d63c1cf74077e6daa6c58524e96c Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:01:23 2021 -0700 s3: VFS: media_harmony: Remove mh_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 7c35fa3466539ca57788c24bc0d7b87c0f27c481 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 18:00:22 2021 -0700 s3: VFS: glusterfs: Remove vfs_gluster_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 2e4e26bb8f318041ceec7a2555c668f42fa5b833 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:58:53 2021 -0700 s3: VFS: ceph_snapshots: Remove ceph_snap_gmt_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3030f4799bc4f39109096460e563a7de9b38a4fd Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:57:45 2021 -0700 s3: VFS: ceph: Remove cephwrap_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit eafc108bcbaf6340db1841909f228debcb017209 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:56:11 2021 -0700 s3: VFS: catia: Remove catia_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 3996f11270d9e5857fe21c93378eb0dd03e7c406 Author: Jeremy Allison <j...@samba.org> Date: Tue Jun 22 17:55:01 2021 -0700 s3: VFS: cap: Remove cap_getxattr. No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 27b8709cf91ae692273956b64f9f3939eb6d36cc Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:56:30 2021 -0700 s3: lib: adouble.c: In ad_read_meta() we can now guarantee a valid fsp. There are now no more callers of SMB_VFS_GETXATTR(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 6a8d052f7c7d198afa6e665cacb8c2b3b2f48eb1 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:55:04 2021 -0700 s3: VFS: fruit: In fruit_streaminfo_meta_netatalk(), ad_get() -> ad_get_meta_fsp(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit d05087d4b8eae55997d97863458fd4490e7406b9 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:53:02 2021 -0700 s3: VFS: fruit: In fruit_stat_meta_netatalk(), ad_get() -> ad_get_meta_fsp(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 99a2a1be1536f20981b8a55ff4a30076e93f264b Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:52:02 2021 -0700 s3: VFS: fruit: In readdir_attr_meta_finderi_netatalk(), ad_get() -> ad_get_meta_fsp(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 88f3ced4e0e9ae1386f120d6b6247257672103ad Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:50:48 2021 -0700 s3: VFS: fruit: In update_btime(), ad_get() -> ad_get_meta_fsp(). Uncomment ad_get_meta_fsp() as we're now using it. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 18b49ad251fac4725aab0aca48d857d4d3853762 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:43:49 2021 -0700 s3: VFS: fruit: Add helper function ad_get_meta_fsp(). Not yet used. We will use this to replace calls to ad_get(..., ADOUBLE_META). It uses openat_pathref_fsp() to get a handle before calling into ad_get(..., ADOUBLE_META). Uses the recursion guard to prevent recursion into openat_pathref_fsp() from stat calls within. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit b2d6ed290611e11150c5383edb18046ef1f58569 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:40:39 2021 -0700 s3: VFS: fruit: In the fruit handle->fruit_config_data, add a recursion guard we will set before calling openat_pathref_fsp(). Not yet used. Same technique as used to prevent recursion in stat calls in vfs_fake_acls.c This will go away once SMB_VFS_STATX() is added and we can select exactly what fields we are calling stat() to get. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 342086d773cbd85c1683ab9fcb1a9c2b225c890f Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:37:56 2021 -0700 s3: VFS: fruit: In fruit_stat_meta_netatalk(), move the call to fruit_stat_base() before the ad_get() call. Both must succeed for a valid return, and we're next going to replace ad_get() with a wrapper that calls openat_pathref_fsp(), which needs a VALID_STAT(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 6eaf027458aea1405331b59b71af51aca59f8cf0 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:47:30 2021 -0700 s3: VFS: fruit: Inside fruit_open_meta_netatalk() change to use fsp->base_fsp->fsp_name in ad_get() instead of smb_fname. We know this will have a valid fsp within. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 53e0494958d0e444c19ef103231d8eba05b3a95e Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 2 13:35:37 2021 -0700 s3: lib: In ad_read_meta(), allow use of SMB_VFS_FGETXATTR() as well as SMB_VFS_GETXATTR(). Eventually we will guarantee a valid smb_fname->fsp here and will remove SMB_VFS_GETXATTR(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 6a366012aaedf400a438e97ffd5e875f0ee649d3 Author: Jeremy Allison <j...@samba.org> Date: Wed Jun 30 18:40:59 2021 -0700 s3: smbd: Fix fsp->base_fsp->fsp_name->fsp == fsp->base_fsp invarient in non_widelink_open(). Currently in master when we call into openat() in the VFS we violate the invarient: fsp->base_fsp->fsp_name->fsp == fsp->base_fsp. The reason for this is subtle. Inside open.c:non_widelink_open() we change the fsp->base_fsp to be relative to the new $cwd. We do this by the following code in open.c:non_widelink_open(): /* Also setup base_fsp to be relative to the new cwd */ if (fsp->base_fsp != NULL) { base_smb_fname_rel = (struct smb_filename) { .base_name = smb_fname_rel->base_name, }; orig_base_fsp_name = fsp->base_fsp->fsp_name; fsp->base_fsp->fsp_name = &base_smb_fname_rel; } Note that fsp->base_fsp->fsp_name now points at a stack variable struct smb_filename, with smb_fname->fsp == NULL. This fixes that problem by removing the horrid stack based smb_filename and changing to use a talloc'ed fsp->base_fsp->fsp_name, with correctly linked fsp->base_fsp->fsp_name-> pointer. Remove the selftest/knownfail.d/fruit_vfs_invariant file as all vfs_fruit tests now pass again. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 4e97e33c3b74d2d66420e9ef509431deae0e67a5 Author: Jeremy Allison <j...@samba.org> Date: Thu Jul 1 11:26:21 2021 -0700 s3: smbd: Code inside non_widelink_open() breaks an invarient inside the VFS. Demonstrate this. vfs_fruit isn't the bad guy here. It's just a convenient place to show that non_widelink_open() violates: fsp->base_fsp->fsp_name->fsp == fsp->base_fsp invarient Add selftest/knownfail.d/fruit_vfs_invariant to show what this breaks. Next patch will fix the non_widelink_open() code and remove the knownfail. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: examples/VFS/skel_opaque.c | 11 ------ examples/VFS/skel_transparent.c | 10 ----- source3/include/vfs.h | 16 +------- source3/include/vfs_macros.h | 5 --- source3/lib/adouble.c | 23 +++++++----- source3/modules/The_New_VFS.org | 2 +- source3/modules/The_New_VFS.txt | 2 +- source3/modules/vfs_cap.c | 43 ---------------------- source3/modules/vfs_catia.c | 60 ------------------------------ source3/modules/vfs_ceph.c | 19 ---------- source3/modules/vfs_ceph_snapshots.c | 45 ----------------------- source3/modules/vfs_default.c | 10 ----- source3/modules/vfs_fruit.c | 69 ++++++++++++++++++++++++++++++----- source3/modules/vfs_full_audit.c | 21 ----------- source3/modules/vfs_glusterfs.c | 11 ------ source3/modules/vfs_media_harmony.c | 38 ------------------- source3/modules/vfs_not_implemented.c | 11 ------ source3/modules/vfs_posix_eadb.c | 15 -------- source3/modules/vfs_shadow_copy2.c | 54 --------------------------- source3/modules/vfs_snapper.c | 53 --------------------------- source3/modules/vfs_time_audit.c | 24 ------------ source3/modules/vfs_unityed_media.c | 32 ---------------- source3/modules/vfs_vxfs.c | 30 --------------- source3/modules/vfs_xattr_tdb.c | 48 ------------------------ source3/smbd/open.c | 46 ++++++++++++++++++++--- source3/smbd/vfs.c | 11 ------ 26 files changed, 118 insertions(+), 591 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index a65deaf3204..25241feeb26 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -821,16 +821,6 @@ static int skel_sys_acl_delete_def_fd(vfs_handle_struct *handle, return -1; } -static ssize_t skel_getxattr(vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size) -{ - errno = ENOSYS; - return -1; -} - struct skel_getxattrat_state { struct vfs_aio_state aio_state; ssize_t xattr_size; @@ -1069,7 +1059,6 @@ static struct vfs_fn_pointers skel_opaque_fns = { .sys_acl_delete_def_fd_fn = skel_sys_acl_delete_def_fd, /* EA operations. */ - .getxattr_fn = skel_getxattr, .getxattrat_send_fn = skel_getxattrat_send, .getxattrat_recv_fn = skel_getxattrat_recv, .fgetxattr_fn = skel_fgetxattr, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 87f974c214b..77121259550 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -1081,15 +1081,6 @@ static int skel_sys_acl_delete_def_fd(vfs_handle_struct *handle, return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FD(handle, fsp); } -static ssize_t skel_getxattr(vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size) -{ - return SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size); -} - struct skel_getxattrat_state { struct vfs_aio_state aio_state; ssize_t xattr_size; @@ -1374,7 +1365,6 @@ static struct vfs_fn_pointers skel_transparent_fns = { .sys_acl_delete_def_fd_fn = skel_sys_acl_delete_def_fd, /* EA operations. */ - .getxattr_fn = skel_getxattr, .getxattrat_send_fn = skel_getxattrat_send, .getxattrat_recv_fn = skel_getxattrat_recv, .fgetxattr_fn = skel_fgetxattr, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index aa2801054b2..ee6e48a62d1 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -359,6 +359,7 @@ * Version 45 - Remove SYS_ACL_GET_FILE * Version 45 - Remove SYS_ACL_BLOB_GET_FILE * Version 45 - Add SMB_VFS_FCHFLAGS + * Version 45 - Remove SMB_VFS_GETXATTR */ #define SMB_VFS_INTERFACE_VERSION 45 @@ -1227,11 +1228,6 @@ struct vfs_fn_pointers { struct files_struct *fsp); /* EA operations. */ - ssize_t (*getxattr_fn)(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size); struct tevent_req *(*getxattrat_send_fn)( TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -1733,11 +1729,6 @@ int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle, SMB_ACL_T theacl); int smb_vfs_call_sys_acl_delete_def_fd(struct vfs_handle_struct *handle, struct files_struct *fsp); -ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size); struct tevent_req *smb_vfs_call_getxattrat_send( TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -2138,11 +2129,6 @@ int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, SMB_ACL_T theacl); int vfs_not_implemented_sys_acl_delete_def_fd(vfs_handle_struct *handle, files_struct *fsp); -ssize_t vfs_not_implemented_getxattr(vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size); struct tevent_req *vfs_not_implemented_getxattrat_send( TALLOC_CTX *mem_ctx, struct tevent_context *ev, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 0c7ce1c5d61..c20db416b54 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -499,11 +499,6 @@ #define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FD(handle, fsp) \ smb_vfs_call_sys_acl_delete_def_fd((handle)->next, (fsp)) -#define SMB_VFS_GETXATTR(conn,smb_fname,name,value,size) \ - smb_vfs_call_getxattr((conn)->vfs_handles,(smb_fname),(name),(value),(size)) -#define SMB_VFS_NEXT_GETXATTR(handle,smb_fname,name,value,size) \ - smb_vfs_call_getxattr((handle)->next,(smb_fname),(name),(value),(size)) - #define SMB_VFS_GETXATTRAT_SEND(mem_ctx,ev,dir_fsp,smb_fname, \ xattr_name, alloc_hint) \ smb_vfs_call_getxattrat_send((mem_ctx),(ev), \ diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index 3788943941e..fd435b6592d 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -2037,12 +2037,19 @@ static ssize_t ad_read_meta(vfs_handle_struct *handle, int rc = 0; ssize_t ealen; bool ok; + struct files_struct *fsp = smb_fname->fsp; DEBUG(10, ("reading meta xattr for %s\n", smb_fname->base_name)); - ealen = SMB_VFS_GETXATTR(handle->conn, smb_fname, - AFPINFO_EA_NETATALK, ad->ad_data, - AD_DATASZ_XATTR); + if (fsp->base_fsp != NULL) { + fsp = fsp->base_fsp; + } + + ealen = SMB_VFS_FGETXATTR(fsp, + AFPINFO_EA_NETATALK, + ad->ad_data, + AD_DATASZ_XATTR); + if (ealen == -1) { switch (errno) { case ENOATTR: @@ -2096,12 +2103,10 @@ exit: if (rc != 0) { ealen = -1; if (errno == EINVAL) { - if (smb_fname->fsp != NULL) { - become_root(); - (void)SMB_VFS_FREMOVEXATTR(smb_fname->fsp, - AFPINFO_EA_NETATALK); - unbecome_root(); - } + become_root(); + (void)SMB_VFS_FREMOVEXATTR(fsp, + AFPINFO_EA_NETATALK); + unbecome_root(); errno = ENOENT; } } diff --git a/source3/modules/The_New_VFS.org b/source3/modules/The_New_VFS.org index f85e005232d..cf8d21a38eb 100644 --- a/source3/modules/The_New_VFS.org +++ b/source3/modules/The_New_VFS.org @@ -247,7 +247,7 @@ whenever VFS access is done in a piecemeal fashion. | SMB_VFS_GET_REAL_FILENAME() | [[P2px][P2px]] | - | | SMB_VFS_GET_SHADOW_COPY_DATA() | [[fsp][fsp]] | - | | SMB_VFS_GETWD() | [[Special][Special]] | - | -| SMB_VFS_GETXATTR() | [[Path][Path]] | Todo | +| SMB_VFS_GETXATTR() | [[Path][Path]] | - | | SMB_VFS_GETXATTRAT_RECV() | [[Enum][Enum]] | - | | SMB_VFS_GETXATTRAT_SEND() | [[Enum][Enum]] | - | | SMB_VFS_KERNEL_FLOCK() | [[fsp][fsp]] | - | diff --git a/source3/modules/The_New_VFS.txt b/source3/modules/The_New_VFS.txt index 6405371c816..2acad5382db 100644 --- a/source3/modules/The_New_VFS.txt +++ b/source3/modules/The_New_VFS.txt @@ -315,7 +315,7 @@ Table of Contents SMB_VFS_GET_REAL_FILENAME() [P2px] - SMB_VFS_GET_SHADOW_COPY_DATA() [fsp] - SMB_VFS_GETWD() [Special] - - SMB_VFS_GETXATTR() [Path] Todo + SMB_VFS_GETXATTR() [Path] - SMB_VFS_GETXATTRAT_RECV() [Enum] - SMB_VFS_GETXATTRAT_SEND() [Enum] - SMB_VFS_KERNEL_FLOCK() [fsp] - diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 3bb3d5d9d5e..fb7f3028507 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -750,48 +750,6 @@ static struct smb_filename *cap_realpath(vfs_handle_struct *handle, return return_fname; } -static ssize_t cap_getxattr(vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size) -{ - struct smb_filename *cap_smb_fname = NULL; - char *cappath = capencode(talloc_tos(), smb_fname->base_name); - char *capname = capencode(talloc_tos(), name); - ssize_t ret; - int saved_errno = 0; - - if (!cappath || !capname) { - errno = ENOMEM; - return -1; - } - cap_smb_fname = synthetic_smb_fname(talloc_tos(), - cappath, - NULL, - NULL, - smb_fname->twrp, - smb_fname->flags); - if (cap_smb_fname == NULL) { - TALLOC_FREE(cappath); - TALLOC_FREE(capname); - errno = ENOMEM; - return -1; - } - ret = SMB_VFS_NEXT_GETXATTR(handle, cap_smb_fname, - capname, value, size); - if (ret == -1) { - saved_errno = errno; - } - TALLOC_FREE(cappath); - TALLOC_FREE(capname); - TALLOC_FREE(cap_smb_fname); - if (saved_errno) { - errno = saved_errno; - } - return ret; -} - static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, void *value, size_t size) { char *cappath = capencode(talloc_tos(), path); @@ -917,7 +875,6 @@ static struct vfs_fn_pointers vfs_cap_fns = { .linkat_fn = cap_linkat, .mknodat_fn = cap_mknodat, .realpath_fn = cap_realpath, - .getxattr_fn = cap_getxattr, .getxattrat_send_fn = vfs_not_implemented_getxattrat_send, .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv, .fgetxattr_fn = cap_fgetxattr, diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 22b0696e73d..bf1c1cd425a 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -972,65 +972,6 @@ catia_fstreaminfo(struct vfs_handle_struct *handle, return NT_STATUS_OK; } -static ssize_t -catia_getxattr(vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size) -{ - struct smb_filename *mapped_smb_fname = NULL; - char *mapped_name = NULL; - char *mapped_ea_name = NULL; - NTSTATUS status; - ssize_t ret; - int saved_errno = 0; - - status = catia_string_replace_allocate(handle->conn, - smb_fname->base_name, - &mapped_name, - vfs_translate_to_unix); - if (!NT_STATUS_IS_OK(status)) { - errno = map_errno_from_nt_status(status); - return -1; - } - - status = catia_string_replace_allocate(handle->conn, - name, &mapped_ea_name, vfs_translate_to_unix); - if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(mapped_name); - errno = map_errno_from_nt_status(status); - return -1; - } - - mapped_smb_fname = synthetic_smb_fname(talloc_tos(), - mapped_name, - NULL, - &smb_fname->st, - smb_fname->twrp, - smb_fname->flags); - if (mapped_smb_fname == NULL) { - TALLOC_FREE(mapped_name); - TALLOC_FREE(mapped_ea_name); - errno = ENOMEM; - return -1; - } - - ret = SMB_VFS_NEXT_GETXATTR(handle, mapped_smb_fname, - mapped_ea_name, value, size); - if (ret == -1) { - saved_errno = errno; - } - TALLOC_FREE(mapped_name); - TALLOC_FREE(mapped_ea_name); - TALLOC_FREE(mapped_smb_fname); - if (saved_errno != 0) { - errno = saved_errno; - } - - return ret; -} - static int catia_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) @@ -1978,7 +1919,6 @@ static struct vfs_fn_pointers vfs_catia_fns = { .sys_acl_set_fd_fn = catia_sys_acl_set_fd, /* EA operations. */ - .getxattr_fn = catia_getxattr, .getxattrat_send_fn = vfs_not_implemented_getxattrat_send, .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv, .fgetxattr_fn = catia_fgetxattr, diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 5cb69e3e3c8..f3efd28107c 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1290,24 +1290,6 @@ static const char *cephwrap_connectpath(struct vfs_handle_struct *handle, Extended attribute operations. *****************************************************************/ -static ssize_t cephwrap_getxattr(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size) -{ - int ret; - DBG_DEBUG("[CEPH] getxattr(%p, %s, %s, %p, %llu)\n", handle, - smb_fname->base_name, name, value, llu(size)); - ret = ceph_getxattr(handle->data, - smb_fname->base_name, name, value, size); - DBG_DEBUG("[CEPH] getxattr(...) = %d\n", ret); - if (ret < 0) { - WRAP_RETURN(ret); - } - return (ssize_t)ret; -} - static ssize_t cephwrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) { int ret; @@ -1641,7 +1623,6 @@ static struct vfs_fn_pointers ceph_fns = { .connectpath_fn = cephwrap_connectpath, /* EA operations. */ - .getxattr_fn = cephwrap_getxattr, .getxattrat_send_fn = vfs_not_implemented_getxattrat_send, .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv, .fgetxattr_fn = cephwrap_fgetxattr, diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 4e226b1d8a1..dd7c431dd9e 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -1278,50 +1278,6 @@ static int ceph_snap_gmt_fchflags(vfs_handle_struct *handle, return SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags); } -static ssize_t ceph_snap_gmt_getxattr(vfs_handle_struct *handle, - const struct smb_filename *csmb_fname, - const char *aname, - void *value, - size_t size) -{ - time_t timestamp = 0; - char stripped[PATH_MAX + 1]; - char conv[PATH_MAX + 1]; - int ret; - struct smb_filename *new_fname; - int saved_errno; - - ret = ceph_snap_gmt_strip_snapshot(handle, - csmb_fname, - ×tamp, stripped, sizeof(stripped)); - if (ret < 0) { - errno = -ret; - return -1; - } - if (timestamp == 0) { - return SMB_VFS_NEXT_GETXATTR(handle, csmb_fname, aname, value, - size); - } - ret = ceph_snap_gmt_convert(handle, stripped, - timestamp, conv, sizeof(conv)); - if (ret < 0) { - errno = -ret; - return -1; - } - new_fname = cp_smb_filename(talloc_tos(), csmb_fname); - if (new_fname == NULL) { - errno = ENOMEM; - return -1; - } - new_fname->base_name = conv; - - ret = SMB_VFS_NEXT_GETXATTR(handle, new_fname, aname, value, size); - saved_errno = errno; - TALLOC_FREE(new_fname); - errno = saved_errno; - return ret; -} - static int ceph_snap_gmt_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *aname, const void *value, @@ -1491,7 +1447,6 @@ static struct vfs_fn_pointers ceph_snap_fns = { .mknodat_fn = ceph_snap_gmt_mknodat, .realpath_fn = ceph_snap_gmt_realpath, .mkdirat_fn = ceph_snap_gmt_mkdirat, - .getxattr_fn = ceph_snap_gmt_getxattr, .getxattrat_send_fn = vfs_not_implemented_getxattrat_send, .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv, .fsetxattr_fn = ceph_snap_gmt_fsetxattr, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index b96badc0de2..e4f6510ec0b 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -3434,15 +3434,6 @@ static int vfswrap_sys_acl_delete_def_fd(vfs_handle_struct *handle, Extended attribute operations. *****************************************************************/ -static ssize_t vfswrap_getxattr(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname, - const char *name, - void *value, - size_t size) -{ - return getxattr(smb_fname->base_name, name, value, size); -} - struct vfswrap_getxattrat_state { struct tevent_context *ev; files_struct *dir_fsp; @@ -4041,7 +4032,6 @@ static struct vfs_fn_pointers vfs_default_fns = { .sys_acl_delete_def_fd_fn = vfswrap_sys_acl_delete_def_fd, /* EA operations. */ - .getxattr_fn = vfswrap_getxattr, .getxattrat_send_fn = vfswrap_getxattrat_send, .getxattrat_recv_fn = vfswrap_getxattrat_recv, .fgetxattr_fn = vfswrap_fgetxattr, diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index ae1541ea9f1..46614939a06 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -144,6 +144,8 @@ struct fruit_config_data { bool readdir_attr_rsize; bool readdir_attr_finder_info; bool readdir_attr_max_access; + /* Recursion guard. Will go away when we have STATX. */ + bool in_openat_pathref_fsp; }; static const struct enum_list fruit_rsrc[] = { @@ -202,6 +204,47 @@ struct fio { * Helper functions *****************************************************************************/ +static struct adouble *ad_get_meta_fsp(TALLOC_CTX *ctx, + vfs_handle_struct *handle, + const struct smb_filename *smb_fname) +{ + NTSTATUS status; + struct adouble *ad = NULL; + struct smb_filename *smb_fname_cp = NULL; + struct fruit_config_data *config = NULL; + + if (smb_fname->fsp != NULL) { + return ad_get(ctx, handle, smb_fname, ADOUBLE_META); + } + + SMB_VFS_HANDLE_GET_DATA(handle, + config, + struct fruit_config_data, + return NULL); + + if (config->in_openat_pathref_fsp) { + return NULL; + } + + smb_fname_cp = cp_smb_filename(ctx, + smb_fname); + if (smb_fname_cp == NULL) { -- Samba Shared Repository