From: Ralph Boehme Date: Fri, 30 Oct 2020 15:03:19 +0000 (+0100) Subject: smbd: use SMB_VFS_FSTAT() in rename_internals_fsp() X-Git-Tag: samba-4.14.0rc1~279 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f19b01a1cbdb1e2047f4c91647e9c82ed6da6acf;p=thirdparty%2Fsamba.git 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 --- 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,