From 54294a1b014586f2a078a1eb73f5352cb93efe63 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 7 Jun 2024 19:35:47 +0100 Subject: [PATCH] HACKY fix for including dfs link(s) in direntries --- source3/smbd/files.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 02cfc424822..c72e92d8834 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -1167,6 +1167,22 @@ next: goto fail; } + if ((fd == -1) && (errno == ENOENT) && S_ISLNK(fsp->fsp_name->st.st_ex_mode)) { + NTSTATUS prev = status; + status = create_open_symlink_err(mem_ctx, + dirfsp, + &rel_fname, + &symlink_err); + if (!NT_STATUS_IS_OK(status)) { + DBG_DEBUG("create_open_symlink_err failed: %s\n", + nt_errstr(status)); + status = prev; + goto fail; + } + symlink_err->st = fsp->fsp_name->st; + status = NT_STATUS_STOPPED_ON_SYMLINK; + goto fail; + } if (fd == -1) { status = map_nt_error_from_unix(errno); DBG_DEBUG("SMB_VFS_OPENAT() failed: %s\n", -- 2.35.3