s3: VFS: Implement create_dfs_pathat() in gluster.
authorJeremy Allison <jra@samba.org>
Thu, 9 Jan 2020 22:48:33 +0000 (14:48 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 10 Jan 2020 19:38:42 +0000 (19:38 +0000)
Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_glusterfs.c

index e8bd64be9e6a90ea513d519f29977b2a70181814..bce7ae5e84ad3706086a71a24fbdf10c5011dc70 100644 (file)
@@ -1869,6 +1869,42 @@ static bool vfs_gluster_aio_force(struct vfs_handle_struct *handle,
        return false;
 }
 
+static NTSTATUS vfs_gluster_create_dfs_pathat(struct vfs_handle_struct *handle,
+                               struct files_struct *dirfsp,
+                               const struct smb_filename *smb_fname,
+                               const struct referral *reflist,
+                               size_t referral_count)
+{
+       TALLOC_CTX *frame = talloc_stackframe();
+       NTSTATUS status = NT_STATUS_NO_MEMORY;
+       int ret;
+       char *msdfs_link = NULL;
+
+       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+
+       /* Form the msdfs_link contents */
+       msdfs_link = msdfs_link_string(frame,
+                                       reflist,
+                                       referral_count);
+       if (msdfs_link == NULL) {
+               goto out;
+       }
+
+       ret = glfs_symlink(handle->data,
+                       msdfs_link,
+                       smb_fname->base_name);
+       if (ret == 0) {
+               status = NT_STATUS_OK;
+       } else {
+               status = map_nt_error_from_unix(errno);
+       }
+
+  out:
+
+       TALLOC_FREE(frame);
+       return status;
+}
+
 static struct vfs_fn_pointers glusterfs_fns = {
 
        /* Disk Operations */
@@ -1941,6 +1977,7 @@ static struct vfs_fn_pointers glusterfs_fns = {
        .streaminfo_fn = NULL,
        .get_real_filename_fn = vfs_gluster_get_real_filename,
        .connectpath_fn = vfs_gluster_connectpath,
+       .create_dfs_pathat_fn = vfs_gluster_create_dfs_pathat,
 
        .brl_lock_windows_fn = NULL,
        .brl_unlock_windows_fn = NULL,