]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: call rename_open_files() a bit earlier in rename_internals_fsp()
authorRalph Boehme <slow@samba.org>
Fri, 30 Oct 2020 14:38:22 +0000 (15:38 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:32 +0000 (09:08 +0000)
This prepares for using handle based SMB_VFS_FSTAT() and fdos_mode() a few lines
below. As some VFS modules will use the fsp->fsp_name we have to make sure to
rename it first.

Fwiw, notify_rename() is moved as well as it needs to original name in
fsp->fsp_name.

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

index 00ac4de617a0795d0ad36707339626cd08e366e4..d360ccfb6cef7e4781b20558a993e42e23153ce6 100644 (file)
@@ -7807,6 +7807,14 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                          "%s -> %s\n", smb_fname_str_dbg(fsp->fsp_name),
                          smb_fname_str_dbg(smb_fname_dst)));
 
+               notify_rename(conn,
+                             fsp->fsp_flags.is_directory,
+                             fsp->fsp_name,
+                             smb_fname_dst);
+
+               rename_open_files(conn, lck, fsp->file_id, fsp->name_hash,
+                                 smb_fname_dst);
+
                if (!fsp->fsp_flags.is_directory &&
                    !(fsp->posix_flags & FSP_POSIX_FLAGS_PATHNAMES) &&
                    (lp_map_archive(SNUM(conn)) ||
@@ -7824,14 +7832,6 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                        }
                }
 
-               notify_rename(conn,
-                             fsp->fsp_flags.is_directory,
-                             fsp->fsp_name,
-                             smb_fname_dst);
-
-               rename_open_files(conn, lck, fsp->file_id, fsp->name_hash,
-                                 smb_fname_dst);
-
                /*
                 * A rename acts as a new file create w.r.t. allowing an initial delete
                 * on close, probably because in Windows there is a new handle to the