From: Jeremy Allison Date: Fri, 18 Mar 2022 19:11:23 +0000 (-0700) Subject: s3: smbd: open_file(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber... X-Git-Tag: tevent-0.12.0~270 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfadecca802600fa9a01fa9781e4df9a0b71fa3c;p=thirdparty%2Fsamba.git s3: smbd: open_file(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags. If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp, we must call vfs_stat_fsp() as this preserves the iflags. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 8b44574c806..8f6bb8eb120 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1544,12 +1544,11 @@ static NTSTATUS open_file(files_struct *fsp, } if (need_re_stat) { - ret = SMB_VFS_FSTAT(fsp, &smb_fname->st); + status = vfs_stat_fsp(fsp); /* * If we have an fd, this stat should succeed. */ - if (ret == -1) { - status = map_nt_error_from_unix(errno); + if (!NT_STATUS_IS_OK(status)) { DBG_ERR("Error doing fstat on open " "file %s (%s)\n", smb_fname_str_dbg(smb_fname),