]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_glusterfs: Simplify SMB_VFS_GET_REAL_FILENAME_AT implementation
authorAnoop C S <anoopcs@samba.org>
Tue, 11 Oct 2022 17:55:46 +0000 (23:25 +0530)
committerRalph Boehme <slow@samba.org>
Wed, 12 Oct 2022 11:46:36 +0000 (11:46 +0000)
It was unnecessary to construct full directory path as "dir/." which is
same as "dir". We could just directly use dirfsp->fsp_name->base_name
for glfs_getxattr() and return the result.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_glusterfs.c

index 4284d7dea1d63d8d6b0d4a033fc60eb4c98d4712..69bc4ab06c6d3cc586e7ca30c6df027d3979c6b9 100644 (file)
@@ -2269,9 +2269,6 @@ static NTSTATUS vfs_gluster_get_real_filename_at(
        char val_buf[GLUSTER_NAME_MAX + 1];
 #ifdef HAVE_GFAPI_VER_7_11
        glfs_fd_t *pglfd = NULL;
-#else
-       struct smb_filename *smb_fname_dot = NULL;
-       struct smb_filename *full_fname = NULL;
 #endif
 
        if (strlen(name) >= GLUSTER_NAME_MAX) {
@@ -2290,29 +2287,11 @@ static NTSTATUS vfs_gluster_get_real_filename_at(
 
        ret = glfs_fgetxattr(pglfd, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
 #else
-       smb_fname_dot = synthetic_smb_fname(mem_ctx,
-                                           ".",
-                                           NULL,
-                                           NULL,
-                                           0,
-                                           0);
-       if (smb_fname_dot == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
-                                                 dirfsp,
-                                                 smb_fname_dot);
-       if (full_fname == NULL) {
-               TALLOC_FREE(smb_fname_dot);
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       ret = glfs_getxattr(handle->data, full_fname->base_name,
-                           key_buf, val_buf, GLUSTER_NAME_MAX + 1);
-
-       TALLOC_FREE(smb_fname_dot);
-       TALLOC_FREE(full_fname);
+       ret = glfs_getxattr(handle->data,
+                           dirfsp->fsp_name->base_name,
+                           key_buf,
+                           val_buf,
+                           GLUSTER_NAME_MAX + 1);
 #endif
 
        if (ret == -1) {