]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: ceph. Ensure read_dfs_pathat() returns stat info.
authorJeremy Allison <jra@samba.org>
Sat, 30 May 2020 00:35:06 +0000 (17:35 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 3 Jun 2020 04:54:38 +0000 (04:54 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14391

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_ceph.c

index 7bc6ba50cd63760fa2136f081a50e931ffb45482..0378d633782a5543932b7d87a719bc409daa15e1 100644 (file)
@@ -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;