From f19b01a1cbdb1e2047f4c91647e9c82ed6da6acf Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 30 Oct 2020 16:03:19 +0100 Subject: [PATCH] smbd: use SMB_VFS_FSTAT() in rename_internals_fsp() While at it, use the open handle on the renamed file to call fstat() instead of stat(). Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/smbd/reply.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index d360ccfb6ce..ec6e4dfaa04 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -7821,9 +7821,12 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, lp_store_dos_attributes(SNUM(conn)))) { /* We must set the archive bit on the newly renamed file. */ - if (SMB_VFS_STAT(conn, smb_fname_dst) == 0) { + if (SMB_VFS_FSTAT(fsp, &smb_fname_dst->st) == 0) { uint32_t old_dosmode = dos_mode(conn, smb_fname_dst); + + fsp->fsp_name->st = smb_fname_dst->st; + file_set_dosmode(conn, smb_fname_dst, old_dosmode | FILE_ATTRIBUTE_ARCHIVE, -- 2.47.3