s3: VFS: ceph: cephwrap_create_dfs_pathat() isn't restricted to dirfsp->conn->cwd_fsp...
authorJeremy Allison <jra@samba.org>
Wed, 17 Mar 2021 04:48:07 +0000 (21:48 -0700)
committerNoel Power <npower@samba.org>
Mon, 22 Mar 2021 18:37:34 +0000 (18:37 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power<npower@samba.org>
source3/modules/vfs_ceph.c

index e2f3691bc4fb3ff9539f6caf7defc5edc05ae685..e371090c95d3187673abd3da275e148ed5e91817 100644 (file)
@@ -1379,8 +1379,14 @@ static NTSTATUS cephwrap_create_dfs_pathat(struct vfs_handle_struct *handle,
        NTSTATUS status = NT_STATUS_NO_MEMORY;
        int ret;
        char *msdfs_link = NULL;
+       struct smb_filename *full_fname = NULL;
 
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               smb_fname);
+       if (full_fname == NULL) {
+               goto out;
+       }
 
        /* Form the msdfs_link contents */
        msdfs_link = msdfs_link_string(frame,
@@ -1392,7 +1398,7 @@ static NTSTATUS cephwrap_create_dfs_pathat(struct vfs_handle_struct *handle,
 
        ret = ceph_symlink(handle->data,
                        msdfs_link,
-                       smb_fname->base_name);
+                       full_fname->base_name);
        if (ret == 0) {
                status = NT_STATUS_OK;
        } else {
@@ -1402,7 +1408,7 @@ static NTSTATUS cephwrap_create_dfs_pathat(struct vfs_handle_struct *handle,
   out:
 
        DBG_DEBUG("[CEPH] create_dfs_pathat(%s) = %s\n",
-                       smb_fname->base_name,
+                       full_fname->base_name,
                        nt_errstr(status));
 
        TALLOC_FREE(frame);