]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_unityed_media. Implement symlinkat().
authorJeremy Allison <jra@samba.org>
Fri, 30 Aug 2019 21:02:53 +0000 (14:02 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 3 Sep 2019 21:15:43 +0000 (21:15 +0000)
Currently identical to symlink().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source3/modules/vfs_unityed_media.c

index 68178691cda1549969a42c726515121ef8b1113b..75da73765c47fffacb69547317e2c17966274d6a 100644 (file)
@@ -1365,6 +1365,47 @@ err:
        return status;
 }
 
+static int um_symlinkat(vfs_handle_struct *handle,
+                       const char *link_contents,
+                       struct files_struct *dirfsp,
+                       const struct smb_filename *new_smb_fname)
+{
+       int status;
+       char *client_link_contents = NULL;
+       struct smb_filename *new_client_fname = NULL;
+
+       DEBUG(10, ("Entering um_symlinkat\n"));
+
+       if (!is_in_media_files(link_contents) &&
+                       !is_in_media_files(new_smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SYMLINKAT(handle,
+                               link_contents,
+                               dirfsp,
+                               new_smb_fname);
+       }
+
+       status = alloc_get_client_path(handle, talloc_tos(),
+                               link_contents, &client_link_contents);
+       if (status != 0) {
+               goto err;
+       }
+       status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                                           new_smb_fname, &new_client_fname);
+       if (status != 0) {
+               goto err;
+       }
+
+       status = SMB_VFS_NEXT_SYMLINKAT(handle,
+                                       client_link_contents,
+                                       dirfsp,
+                                       new_client_fname);
+
+err:
+       TALLOC_FREE(client_link_contents);
+       TALLOC_FREE(new_client_fname);
+       return status;
+}
+
 static int um_readlinkat(vfs_handle_struct *handle,
                        files_struct *dirfsp,
                        const struct smb_filename *smb_fname,
@@ -1932,6 +1973,7 @@ static struct vfs_fn_pointers vfs_um_fns = {
        .chdir_fn = um_chdir,
        .ntimes_fn = um_ntimes,
        .symlink_fn = um_symlink,
+       .symlinkat_fn = um_symlinkat,
        .readlinkat_fn = um_readlinkat,
        .linkat_fn = um_linkat,
        .mknodat_fn = um_mknodat,