From: Ralph Boehme Date: Mon, 11 Jan 2021 09:53:31 +0000 (+0100) Subject: vfs_glusterfs: support read dirfsps in vfs_gluster_openat() X-Git-Tag: samba-4.14.0rc1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b31405e31bc29c3ff3f4232c20363ad5a52c80dc;p=thirdparty%2Fsamba.git vfs_glusterfs: support read dirfsps in vfs_gluster_openat() Signed-off-by: Ralph Boehme Reviewed-by: Anoop C S Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Mon Jan 11 21:34:52 UTC 2021 on sn-devel-184 --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 45516441ba8..ddead1f269c 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -742,6 +742,7 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, int flags, mode_t mode) { + struct smb_filename *name = NULL; bool became_root = false; glfs_fd_t *glfd; glfs_fd_t **p_tmp; @@ -751,10 +752,19 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, /* * Looks like glfs API doesn't have openat(). */ - SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD); + if (fsp_get_pathref_fd(dirfsp) != AT_FDCWD) { + name = full_path_from_dirfsp_atname(talloc_tos(), + dirfsp, + smb_fname); + if (name == NULL) { + return -1; + } + smb_fname = name; + } p_tmp = VFS_ADD_FSP_EXTENSION(handle, fsp, glfs_fd_t *, NULL); if (p_tmp == NULL) { + TALLOC_FREE(name); END_PROFILE(syscall_openat); errno = ENOMEM; return -1; @@ -785,6 +795,7 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, fsp->fsp_flags.have_proc_fds = false; if (glfd == NULL) { + TALLOC_FREE(name); END_PROFILE(syscall_openat); /* no extension destroy_fn, so no need to save errno */ VFS_REMOVE_FSP_EXTENSION(handle, fsp); @@ -793,6 +804,7 @@ static int vfs_gluster_openat(struct vfs_handle_struct *handle, *p_tmp = glfd; + TALLOC_FREE(name); END_PROFILE(syscall_openat); /* An arbitrary value for error reporting, so you know its us. */ return 13371337;