From: Ralph Boehme Date: Mon, 29 Nov 2021 22:09:33 +0000 (+0100) Subject: vfs_gpfs: use sys_fstatat() in stat_with_capability() X-Git-Tag: tevent-0.13.0~338 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=994c262b883740c48ce1fe37eb262b009b9e971f;p=thirdparty%2Fsamba.git vfs_gpfs: use sys_fstatat() in stat_with_capability() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12421 Signed-off-by: Ralph Boehme Reviewed-by: Bjoern Jacke --- diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index ca1a9a39479..db167d00226 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -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; }