From: Jeremy Allison Date: Thu, 17 Dec 2020 07:59:50 +0000 (-0800) Subject: smbd: If an smb_filename already has a pathref fsp don't overwrite it. X-Git-Tag: samba-4.14.0rc1~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7f1588ee490249204fd730663d2161d6a5fa6e0;p=thirdparty%2Fsamba.git smbd: If an smb_filename already has a pathref fsp don't overwrite it. That leaks fsps. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index a4167b9c0f4..57fd67ab426 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -414,6 +414,13 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, DBG_DEBUG("smb_fname [%s]\n", smb_fname_str_dbg(smb_fname)); + if (smb_fname->fsp != NULL) { + /* We already have one for this name. */ + DBG_DEBUG("smb_fname [%s] already has a pathref fsp.\n", + smb_fname_str_dbg(smb_fname)); + return NT_STATUS_OK; + } + if (file_existed && S_ISLNK(smb_fname->st.st_ex_mode)) { return NT_STATUS_STOPPED_ON_SYMLINK; }