int vfswrap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { int result; BOOL has_dacl = False; START_PROFILE(syscall_mkdir); if (lp_inherit_acls(SNUM(conn)) && (has_dacl = directory_has_default_acl(conn, parent_dirname(path)))) mode = 0777; result = mkdir(path, mode); if (result == 0 && !has_dacl) { /* * We need to do this as the default behavior of POSIX ACLs * is to set the mask to be the requested group permission * bits, not the group permission bits to be the requested * group permission bits. This is not what we want, as it will * mess up any inherited ACL bits that were set. JRA. */ int saved_errno = errno; /* We may get ENOSYS */ if ((SMB_VFS_CHMOD_ACL(conn, path, mode) == -1) && (errno == ENOSYS)) errno = saved_errno; } END_PROFILE(syscall_mkdir); return result; }
static int cephwrap_mkdir(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode) { int result; char *parent = NULL; const char *path = smb_fname->base_name; DBG_DEBUG("[CEPH] mkdir(%p, %s)\n", handle, path); if (lp_inherit_acls(SNUM(handle->conn)) && parent_dirname(talloc_tos(), path, &parent, NULL) && directory_has_default_acl(handle->conn, parent)) { mode = 0777; } TALLOC_FREE(parent); result = ceph_mkdir(handle->data, path, mode); return WRAP_RETURN(result); }