s3: VFS: vfs_cap. Implement mkdirat().
authorJeremy Allison <jra@samba.org>
Wed, 4 Sep 2019 20:53:43 +0000 (13:53 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 11 Sep 2019 18:24:28 +0000 (18:24 +0000)
Currently identical to mkdir().

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

index 9999901056a9e0bcf3dc625c5455c355d8c65bc9..3f75ba1c2e7bc354112874b3b2370fc869707e78 100644 (file)
@@ -165,6 +165,36 @@ static int cap_mkdir(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_MKDIR(handle, cap_smb_fname, mode);
 }
 
+static int cap_mkdirat(vfs_handle_struct *handle,
+               struct files_struct *dirfsp,
+               const struct smb_filename *smb_fname,
+               mode_t mode)
+{
+       char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+       struct smb_filename *cap_smb_fname = NULL;
+
+       if (!cappath) {
+               errno = ENOMEM;
+               return -1;
+       }
+
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       cappath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(cappath);
+               errno = ENOMEM;
+               return -1;
+       }
+
+       return SMB_VFS_NEXT_MKDIRAT(handle,
+                       dirfsp,
+                       cap_smb_fname,
+                       mode);
+}
+
 static int cap_rmdir(vfs_handle_struct *handle,
                const struct smb_filename *smb_fname)
 {
@@ -1032,6 +1062,7 @@ static struct vfs_fn_pointers vfs_cap_fns = {
        .opendir_fn = cap_opendir,
        .readdir_fn = cap_readdir,
        .mkdir_fn = cap_mkdir,
+       .mkdirat_fn = cap_mkdirat,
        .rmdir_fn = cap_rmdir,
        .open_fn = cap_open,
        .renameat_fn = cap_renameat,