mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
smbd: move mode logic out of vfswrap_mkdirat() to the caller mkdir_internal()
This is the correct place where this code should be. It also means opaque VFS modules that implement their own mkdirat() like glusterfs now use this logic. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
1af5892a98
commit
b54158fb72
@ -365,26 +365,12 @@ static int cephwrap_mkdirat(struct vfs_handle_struct *handle,
|
||||
mode_t mode)
|
||||
{
|
||||
int result;
|
||||
struct smb_filename *parent = NULL;
|
||||
bool ok;
|
||||
|
||||
DBG_DEBUG("[CEPH] mkdir(%p, %s)\n",
|
||||
handle, smb_fname_str_dbg(smb_fname));
|
||||
|
||||
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
|
||||
|
||||
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,
|
||||
dirfsp,
|
||||
parent))
|
||||
{
|
||||
mode = 0777;
|
||||
}
|
||||
}
|
||||
|
||||
TALLOC_FREE(parent);
|
||||
|
||||
result = ceph_mkdir(handle->data, smb_fname->base_name, mode);
|
||||
return WRAP_RETURN(result);
|
||||
}
|
||||
|
@ -670,25 +670,11 @@ static int vfswrap_mkdirat(vfs_handle_struct *handle,
|
||||
mode_t mode)
|
||||
{
|
||||
int result;
|
||||
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))) {
|
||||
ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL);
|
||||
if (ok && directory_has_default_acl(handle->conn,
|
||||
dirfsp,
|
||||
parent))
|
||||
{
|
||||
mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
|
||||
}
|
||||
}
|
||||
|
||||
TALLOC_FREE(parent);
|
||||
|
||||
result = mkdirat(fsp_get_pathref_fd(dirfsp), smb_fname->base_name, mode);
|
||||
|
||||
END_PROFILE(syscall_mkdirat);
|
||||
|
@ -4364,6 +4364,14 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
|
||||
return status;
|
||||
}
|
||||
|
||||
if (lp_inherit_acls(SNUM(conn))) {
|
||||
if (directory_has_default_acl(conn,
|
||||
conn->cwd_fsp,
|
||||
parent_dir_fname)) {
|
||||
mode = (0777 & lp_directory_mask(SNUM(conn)));
|
||||
}
|
||||
}
|
||||
|
||||
ret = SMB_VFS_MKDIRAT(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_dname,
|
||||
|
Loading…
x
Reference in New Issue
Block a user