From 8bd6908baef37015c2123d75f014509069ae6eb9 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 28 Apr 2020 14:41:21 +0200 Subject: [PATCH] vfs_ceph: use parent_smb_fname() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/modules/vfs_ceph.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 7f4d65d4871..1e02a3fe2d8 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -355,22 +355,26 @@ static int cephwrap_mkdirat(struct vfs_handle_struct *handle, mode_t mode) { int result; - char *parent = NULL; - const char *path = smb_fname->base_name; + struct smb_filename *parent = NULL; + bool ok; - DBG_DEBUG("[CEPH] mkdir(%p, %s)\n", handle, path); + 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)) - && parent_dirname(talloc_tos(), path, &parent, NULL) - && directory_has_default_acl(handle->conn, parent)) { - mode = 0777; + 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; + } } TALLOC_FREE(parent); - result = ceph_mkdir(handle->data, path, mode); + result = ceph_mkdir(handle->data, smb_fname->base_name, mode); return WRAP_RETURN(result); } -- 2.47.3