]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: drop pathref from smb_fname_dst_in in rename_internals_fsp()
authorRalph Boehme <slow@samba.org>
Thu, 29 Oct 2020 17:36:08 +0000 (18:36 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:31 +0000 (09:08 +0000)
The pathref is not needed anymore below this point and it conflicts with the
code that checks for open handles on the destination just below.

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

index e5d883bd351b12605b0452c1b5cf2c82358ceea2..7cb4e976fbd064a632b5cc3263a42ec009f56722 100644 (file)
@@ -7724,6 +7724,16 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                goto out;
        }
 
+       /*
+        * Drop the pathref fsp on the destination otherwise we trip upon in in
+        * the below check for open files check.
+        */
+       if (smb_fname_dst_in->fsp != NULL) {
+               fd_close(smb_fname_dst_in->fsp);
+               file_free(NULL, smb_fname_dst_in->fsp);
+               SMB_ASSERT(smb_fname_dst_in->fsp == NULL);
+       }
+
        if (dst_exists) {
                struct file_id fileid = vfs_file_id_from_sbuf(conn,
                    &smb_fname_dst->st);