]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_CREATE_DFS_PATHAT
authorAnoop C S <anoopcs@samba.org>
Fri, 19 Aug 2022 07:21:16 +0000 (12:51 +0530)
committerJeremy Allison <jra@samba.org>
Fri, 26 Aug 2022 16:31:38 +0000 (16:31 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15157

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_glusterfs.c

index bfcf85007c08c30d84ccb0594b43344896f89d82..c47089d5d4d19a07275469377fc016d631bddeba 100644 (file)
@@ -2403,14 +2403,11 @@ static NTSTATUS vfs_gluster_create_dfs_pathat(struct vfs_handle_struct *handle,
        NTSTATUS status = NT_STATUS_NO_MEMORY;
        int ret;
        char *msdfs_link = NULL;
+#ifdef HAVE_GFAPI_VER_7_11
+       glfs_fd_t *pglfd = NULL;
+#else
        struct smb_filename *full_fname = NULL;
-
-       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
-                                                 dirfsp,
-                                                 smb_fname);
-       if (full_fname == NULL) {
-               goto out;
-       }
+#endif
 
        /* Form the msdfs_link contents */
        msdfs_link = msdfs_link_string(frame,
@@ -2420,9 +2417,27 @@ static NTSTATUS vfs_gluster_create_dfs_pathat(struct vfs_handle_struct *handle,
                goto out;
        }
 
-       ret = glfs_symlink(handle->data,
-                       msdfs_link,
-                       full_fname->base_name);
+#ifdef HAVE_GFAPI_VER_7_11
+       pglfd = vfs_gluster_fetch_glfd(handle, dirfsp);
+       if (pglfd == NULL) {
+               DBG_ERR("Failed to fetch gluster fd\n");
+               status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               goto out;
+       }
+
+       ret = glfs_symlinkat(msdfs_link, pglfd, smb_fname->base_name);
+#else
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               goto out;
+       }
+
+       ret = glfs_symlink(handle->data, msdfs_link, full_fname->base_name);
+
+       TALLOC_FREE(full_fname);
+#endif
        if (ret == 0) {
                status = NT_STATUS_OK;
        } else {