From: Volker Lendecke Date: Sun, 15 Oct 2023 15:56:46 +0000 (+0200) Subject: smbd: We don't reopen anything but dirs and files X-Git-Tag: talloc-2.4.2~835 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac60b7a14557aaab5fe9c84df53c7bb8bebd6318;p=thirdparty%2Fsamba.git smbd: We don't reopen anything but dirs and files Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 4b1d5a4de65..8c34269c86c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1229,10 +1229,18 @@ static NTSTATUS reopen_from_fsp(struct files_struct *dirfsp, struct smb_filename proc_fname = (struct smb_filename){ .base_name = sys_proc_fd_path(old_fd, &buf), }; + mode_t mode = fsp->fsp_name->st.st_ex_mode; int new_fd; SMB_ASSERT(fsp->fsp_flags.is_pathref); + if (S_ISLNK(mode)) { + return NT_STATUS_STOPPED_ON_SYMLINK; + } + if (!(S_ISREG(mode) || S_ISDIR(mode))) { + return NT_STATUS_IO_REPARSE_TAG_NOT_HANDLED; + } + fsp->fsp_flags.is_pathref = false; new_fd = SMB_VFS_OPENAT(fsp->conn,