s3: VFS: Implement create_dfs_pathat() in catia.
authorJeremy Allison <jra@samba.org>
Tue, 28 Jan 2020 22:59:46 +0000 (14:59 -0800)
committerRalph Boehme <slow@samba.org>
Thu, 30 Jan 2020 18:21:47 +0000 (18:21 +0000)
Now we use this instead of symlinks to create
DFS links, it's needed in cap.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jan 30 18:21:47 UTC 2020 on sn-devel-184

source3/modules/vfs_cap.c

index f1ec5807b49aa1104264fabe357e744503d55bee..bc6daeccca78f03bc393c0d2a73a6ef7a8a2d461 100644 (file)
@@ -976,6 +976,38 @@ static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, co
         return SMB_VFS_NEXT_FSETXATTR(handle, fsp, cappath, value, size, flags);
 }
 
+static NTSTATUS cap_create_dfs_pathat(vfs_handle_struct *handle,
+                       files_struct *dirfsp,
+                       const struct smb_filename *smb_fname,
+                       const struct referral *reflist,
+                       size_t referral_count)
+{
+       char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+       struct smb_filename *cap_smb_fname = NULL;
+       NTSTATUS status;
+
+       if (cappath == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       cappath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(cappath);
+               return NT_STATUS_NO_MEMORY;
+       }
+       status = SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle,
+                       dirfsp,
+                       cap_smb_fname,
+                       reflist,
+                       referral_count);
+       TALLOC_FREE(cappath);
+       TALLOC_FREE(cap_smb_fname);
+       return status;
+}
+
 static struct vfs_fn_pointers vfs_cap_fns = {
        .disk_free_fn = cap_disk_free,
        .get_quota_fn = cap_get_quota,
@@ -1007,7 +1039,8 @@ static struct vfs_fn_pointers vfs_cap_fns = {
        .removexattr_fn = cap_removexattr,
        .fremovexattr_fn = cap_fremovexattr,
        .setxattr_fn = cap_setxattr,
-       .fsetxattr_fn = cap_fsetxattr
+       .fsetxattr_fn = cap_fsetxattr,
+       .create_dfs_pathat_fn = cap_create_dfs_pathat
 };
 
 static_decl_vfs;