]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: If an smb_filename already has a pathref fsp don't overwrite it.
authorJeremy Allison <jra@samba.org>
Thu, 17 Dec 2020 07:59:50 +0000 (23:59 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 17 Dec 2020 18:56:28 +0000 (18:56 +0000)
That leaks fsps.

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

index a4167b9c0f4cf756ebf0402e557a56c4b1971fc9..57fd67ab4262df929b9a65925b9a11c3f7409d06 100644 (file)
@@ -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;
        }