s3: DFS: Parse the returned target path in dfs_path_lookup().
authorJeremy Allison <jra@samba.org>
Tue, 11 Feb 2020 22:21:12 +0000 (14:21 -0800)
committerKarolin Seeger <kseeger@samba.org>
Wed, 19 Feb 2020 06:19:37 +0000 (06:19 +0000)
Currently unused, but this will ease the transition to
using SMB_VFS_READ_DFS_PATHAT().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14282

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 1ffc52abedae9787f745795a4f502c26b4c005d1)

source3/smbd/msdfs.c

index d9c2d8f46476873ae99c56e0f8248f5470b6fbd8..92583564d4832a2854177061b24c3cf7b9f44e4e 100644 (file)
@@ -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;
 }