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)
committerRalph Boehme <slow@samba.org>
Tue, 18 Feb 2020 21:08:33 +0000 (21:08 +0000)
Currently unused, but this will ease the transition to
using SMB_VFS_READ_DFS_PATHAT().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/msdfs.c

index fa8272f73bb06a26ca26cf89f0f77867ae97d513..ada261651cb76ca0b3d18c219c692df1e8bb0ca4 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;
 }