From: Jeremy Allison Date: Sat, 30 May 2020 00:35:06 +0000 (-0700) Subject: s3: VFS: ceph. Ensure read_dfs_pathat() returns stat info. X-Git-Tag: ldb-2.2.0~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e9e7e2d0cf96ea70b3db71341f4576da147b354;p=thirdparty%2Fsamba.git s3: VFS: ceph. 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_ceph.c b/source3/modules/vfs_ceph.c index 7bc6ba50cd6..0378d633782 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1354,9 +1354,16 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle, #else char link_target_buf[7]; #endif + struct ceph_statx stx; + 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 @@ -1372,6 +1379,16 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle, } } + ret = ceph_statx(handle->data, + smb_fname->base_name, + &stx, + SAMBA_STATX_ATTR_MASK, + AT_SYMLINK_NOFOLLOW); + if (ret < 0) { + status = map_nt_error_from_unix(-ret); + goto err; + } + referral_len = ceph_readlink(handle->data, smb_fname->base_name, link_target, @@ -1404,6 +1421,7 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle, if (ppreflist == NULL && preferral_count == NULL) { /* Early return for checking if this is a DFS link. */ + init_stat_ex_from_ceph_statx(&smb_fname->st, &stx); return NT_STATUS_OK; } @@ -1414,6 +1432,7 @@ static NTSTATUS cephwrap_read_dfs_pathat(struct vfs_handle_struct *handle, preferral_count); if (ok) { + init_stat_ex_from_ceph_statx(&smb_fname->st, &stx); status = NT_STATUS_OK; } else { status = NT_STATUS_NO_MEMORY;