]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use SMB_VFS_FSTAT() in rename_internals_fsp()
authorRalph Boehme <slow@samba.org>
Fri, 30 Oct 2020 15:03:19 +0000 (16:03 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:32 +0000 (09:08 +0000)
While at it, use the open handle on the renamed file to call fstat() instead of
stat().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/reply.c

index d360ccfb6cef7e4781b20558a993e42e23153ce6..ec6e4dfaa043c1750e9f414ab6aefc1d0080660e 100644 (file)
@@ -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,