]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: use parent_smb_fname()
authorRalph Boehme <slow@samba.org>
Tue, 28 Apr 2020 12:43:20 +0000 (14:43 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 16:39:39 +0000 (16:39 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index 2a7e04f79d13336fd96f75367cfd485ead88fb7d..de4fc5d6a1b2278da1a75e91ae298bcdb249b060 100644 (file)
@@ -628,22 +628,25 @@ static int vfswrap_mkdirat(vfs_handle_struct *handle,
                        mode_t mode)
 {
        int result;
-       const char *path = smb_fname->base_name;
-       char *parent = NULL;
+       struct smb_filename *parent = NULL;
+       bool ok;
 
        START_PROFILE(syscall_mkdirat);
 
        SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
 
-       if (lp_inherit_acls(SNUM(handle->conn))
-           && parent_dirname(talloc_tos(), path, &parent, NULL)
-           && directory_has_default_acl(handle->conn, parent)) {
-               mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
+       if (lp_inherit_acls(SNUM(handle->conn))) {
+               ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL);
+               if (ok && directory_has_default_acl(handle->conn,
+                                                   parent->base_name))
+               {
+                       mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
+               }
        }
 
        TALLOC_FREE(parent);
 
-       result = mkdirat(dirfsp->fh->fd, path, mode);
+       result = mkdirat(dirfsp->fh->fd, smb_fname->base_name, mode);
 
        END_PROFILE(syscall_mkdirat);
        return result;