From: Ralph Boehme Date: Thu, 29 Oct 2020 17:36:08 +0000 (+0100) Subject: smbd: drop pathref from smb_fname_dst_in in rename_internals_fsp() X-Git-Tag: samba-4.14.0rc1~294 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e9887c24f7a0706f0e4db5078f5f62845d25fe7;p=thirdparty%2Fsamba.git smbd: drop pathref from smb_fname_dst_in in rename_internals_fsp() 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index e5d883bd351..7cb4e976fbd 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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);