From: Ralph Boehme Date: Mon, 23 Nov 2020 04:59:02 +0000 (+0100) Subject: smbd: add smb_fname_fsp_unlink() X-Git-Tag: samba-4.14.0rc1~369 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d764c183eb5704064fdcbeb2903fba06a1481d37;p=thirdparty%2Fsamba.git smbd: add smb_fname_fsp_unlink() Remove the link between an smb_fname and it's embedded smb_fname->fsp. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 7315d7fb75a..e69a910e1f8 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -553,6 +553,13 @@ fail: return status; } +void smb_fname_fsp_unlink(struct smb_filename *smb_fname) +{ + talloc_set_destructor(smb_fname, NULL); + smb_fname->fsp = NULL; + destroy_fsp_smb_fname_link(&smb_fname->fsp_link); +} + /**************************************************************************** Close all open files for a connection. ****************************************************************************/ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b37c6e36bde..c79f4814f1e 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -458,6 +458,8 @@ NTSTATUS open_internal_dirfsp(connection_struct *conn, NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, struct smb_filename *smb_fname); +void smb_fname_fsp_unlink(struct smb_filename *smb_fname); + /* The following definitions come from smbd/ipc.c */ NTSTATUS nt_status_np_pipe(NTSTATUS status);