From 88e8bfec59412fdc0e83251fef60b45d2cc3a884 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 9 Aug 2022 12:11:07 -0700 Subject: [PATCH] s3: smbd: Switch get_referred_path() over to use the new dfs_path_lookup(). New function doesn't need a TWRP argument and returns NT_STATUS_OK on successful redirect, not NT_STATUS_PATH_NOT_COVERED. Comment out the old dfs_path_lookup(). There are now no more users of unix_convert(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=15144 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/msdfs.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index ab7f9f0ad78..55ab12a75e3 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -713,7 +713,6 @@ bool is_msdfs_link(struct files_struct *dirfsp, return (NT_STATUS_IS_OK(status)); } -#if 0 /***************************************************************** Used by other functions to decide if a dfs path is remote, and to get the list of referred locations for that remote path. @@ -972,8 +971,8 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx, TALLOC_FREE(canon_dfspath); return status; } -#endif +#if 0 /***************************************************************** Used by other functions to decide if a dfs path is remote, and to get the list of referred locations for that remote path. @@ -1162,6 +1161,7 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx, TALLOC_FREE(smb_fname); return status; } +#endif /***************************************************************** Decides if a dfs pathname should be redirected or not. @@ -1420,40 +1420,21 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx, } } - /* If this is a DFS path dfs_lookup should return - * NT_STATUS_PATH_NOT_COVERED. */ - status = dfs_path_lookup(ctx, conn, dfs_path, reqpath, 0, /* ucf_flags */ - NULL, consumedcntp, &jucn->referral_list, &jucn->referral_count); - if (!NT_STATUS_EQUAL(status, NT_STATUS_PATH_NOT_COVERED)) { - DEBUG(3,("get_referred_path: No valid referrals for path %s\n", - dfs_path)); - if (NT_STATUS_IS_OK(status)) { - /* - * We are in an error path here (we - * know it's not a DFS path), but - * dfs_path_lookup() can return - * NT_STATUS_OK. Ensure we always - * return a valid error code. - * - * #9588 - ACLs are not inherited to directories - * for DFS shares. - */ - status = NT_STATUS_NOT_FOUND; - } - goto err_exit; + if (!NT_STATUS_IS_OK(status)) { + DBG_NOTICE("No valid referrals for path %s (%s)\n", + dfs_path, + nt_errstr(status)); } - status = NT_STATUS_OK; - err_exit: TALLOC_FREE(frame); return status; }