1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

vfs_glusterfs: support read dirfsps in vfs_gluster_openat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jan 11 21:34:52 UTC 2021 on sn-devel-184
This commit is contained in:
Ralph Boehme 2021-01-11 10:53:31 +01:00
parent 9a3cdb68fc
commit b31405e31b

View File

@ -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;