From: Jeremy Allison Date: Tue, 11 Feb 2020 22:21:12 +0000 (-0800) Subject: s3: DFS: Parse the returned target path in dfs_path_lookup(). X-Git-Tag: ldb-2.1.1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ffc52abedae9787f745795a4f502c26b4c005d1;p=thirdparty%2Fsamba.git s3: DFS: Parse the returned target path in dfs_path_lookup(). Currently unused, but this will ease the transition to using SMB_VFS_READ_DFS_PATHAT(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index fa8272f73bb..ada261651cb 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -855,6 +855,31 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx, status = NT_STATUS_OK; out: + + if (NT_STATUS_EQUAL(status, NT_STATUS_PATH_NOT_COVERED)) { + /* + * We're returning a DFS redirect. If we have + * the targetpath, parse it here. This will ease + * the code transition to SMB_VFS_READ_DFS_PATHAT(). + * (which will make this code redundent). + */ + if (pp_targetpath != NULL) { + struct referral *preflist = NULL; + size_t referral_count = 0; + + bool ok = parse_msdfs_symlink(ctx, + lp_msdfs_shuffle_referrals(SNUM(conn)), + *pp_targetpath, + &preflist, + &referral_count); + TALLOC_FREE(preflist); + if (!ok) { + status = NT_STATUS_NO_MEMORY; + } + } + + } + TALLOC_FREE(smb_fname); return status; }