vfs_gpfs: use sys_fstatat() in stat_with_capability()
authorRalph Boehme <slow@samba.org>
Mon, 29 Nov 2021 22:09:33 +0000 (23:09 +0100)
committerChristof Schmitt <cs@samba.org>
Wed, 22 Jun 2022 18:05:32 +0000 (18:05 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12421

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
source3/modules/vfs_gpfs.c

index ca1a9a3947970f4852677de70554ea63916fd0ce..db167d002260ab699ba7832c9191668aa5d51b06 100644 (file)
@@ -1605,11 +1605,11 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
 static int stat_with_capability(struct vfs_handle_struct *handle,
                                struct smb_filename *smb_fname, int flag)
 {
+       bool fake_dctime = lp_fake_directory_create_times(SNUM(handle->conn));
        int fd = -1;
        NTSTATUS status;
        struct smb_filename *dir_name = NULL;
        struct smb_filename *rel_name = NULL;
-       struct stat st;
        int ret = -1;
 
        status = SMB_VFS_PARENT_PATHNAME(handle->conn,
@@ -1629,18 +1629,17 @@ static int stat_with_capability(struct vfs_handle_struct *handle,
        }
 
        set_effective_capability(DAC_OVERRIDE_CAPABILITY);
-       ret = fstatat(fd, rel_name->base_name, &st, flag);
+       ret = sys_fstatat(fd,
+                               rel_name->base_name,
+                               &smb_fname->st,
+                               flag,
+                               fake_dctime);
+
        drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
 
        TALLOC_FREE(dir_name);
        close(fd);
 
-       if (ret == 0) {
-               init_stat_ex_from_stat(
-                       &smb_fname->st, &st,
-                       lp_fake_directory_create_times(SNUM(handle->conn)));
-       }
-
        return ret;
 }