From: Jeremy Allison Date: Sat, 30 May 2020 00:49:17 +0000 (-0700) Subject: s3: VFS: gluster. Ensure read_dfs_pathat() returns stat info. X-Git-Tag: ldb-2.2.0~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=636c83741a4c8f14182b4e9216d2d1ca3a40e0e6;p=thirdparty%2Fsamba.git s3: VFS: gluster. Ensure read_dfs_pathat() returns stat info. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14391 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 658e4635eef..ff5382af9fb 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1955,9 +1955,16 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle, #else char link_target_buf[7]; #endif + struct stat st; + int ret; SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); + if (is_named_stream(smb_fname)) { + status = NT_STATUS_OBJECT_NAME_NOT_FOUND; + goto err; + } + if (ppreflist == NULL && preferral_count == NULL) { /* * We're only checking if this is a DFS @@ -1973,6 +1980,12 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle, } } + ret = glfs_lstat(handle->data, smb_fname->base_name, &st); + if (ret < 0) { + status = map_nt_error_from_unix(errno); + goto err; + } + referral_len = glfs_readlink(handle->data, smb_fname->base_name, link_target, @@ -2003,6 +2016,7 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle, if (ppreflist == NULL && preferral_count == NULL) { /* Early return for checking if this is a DFS link. */ + smb_stat_ex_from_stat(&smb_fname->st, &st); return NT_STATUS_OK; } @@ -2013,6 +2027,7 @@ static NTSTATUS vfs_gluster_read_dfs_pathat(struct vfs_handle_struct *handle, preferral_count); if (ok) { + smb_stat_ex_from_stat(&smb_fname->st, &st); status = NT_STATUS_OK; } else { status = NT_STATUS_NO_MEMORY;