From: Ralph Boehme Date: Tue, 29 Sep 2020 08:56:19 +0000 (+0200) Subject: vfs_default: support pathref fd's in vfswrap_flistxattr() X-Git-Tag: samba-4.14.0rc1~396 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f353bca64a7e64c951ca2c5ba04bdda4333a0d6;p=thirdparty%2Fsamba.git vfs_default: support pathref fd's in vfswrap_flistxattr() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index b0ed0395e5f..1ec6f20fd95 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -3590,7 +3590,28 @@ static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { - return flistxattr(fsp_get_io_fd(fsp), list, size); + int fd = fsp_get_pathref_fd(fsp); + + if (!fsp->fsp_flags.is_pathref) { + return flistxattr(fd, list, size); + } + + if (fsp->fsp_flags.have_proc_fds) { + const char *p = NULL; + char buf[PATH_MAX]; + + p = sys_proc_fd_path(fd, buf, sizeof(buf)); + if (p == NULL) { + return -1; + } + + return listxattr(p, list, size); + } + + /* + * This is no longer a handle based call. + */ + return listxattr(fsp->fsp_name->base_name, list, size); } static int vfswrap_removexattr(struct vfs_handle_struct *handle,