1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

smbd: pass struct smb_filename to directory_has_default_acl()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-04-28 18:03:41 +02:00 committed by Jeremy Allison
parent aa0ec8a209
commit d9ae1c78b9
5 changed files with 7 additions and 18 deletions

View File

@ -365,9 +365,7 @@ static int cephwrap_mkdirat(struct vfs_handle_struct *handle,
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))
{
if (ok && directory_has_default_acl(handle->conn, parent)) {
mode = 0777;
}
}

View File

@ -637,9 +637,7 @@ static int vfswrap_mkdirat(vfs_handle_struct *handle,
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))
{
if (ok && directory_has_default_acl(handle->conn, parent)) {
mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
}
}

View File

@ -140,20 +140,12 @@ bool can_write_to_file(connection_struct *conn,
Check for an existing default Windows ACL on a directory.
****************************************************************************/
bool directory_has_default_acl(connection_struct *conn, const char *fname)
bool directory_has_default_acl(connection_struct *conn,
struct smb_filename *smb_fname)
{
struct security_descriptor *secdesc = NULL;
unsigned int i;
NTSTATUS status;
struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(),
fname,
NULL,
NULL,
0);
if (smb_fname == NULL) {
return false;
}
status = SMB_VFS_GET_NT_ACL(conn, smb_fname,
SECINFO_DACL, talloc_tos(),

View File

@ -3615,7 +3615,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
*/
if ((flags2 & O_CREAT) && lp_inherit_acls(SNUM(conn)) &&
(def_acl = directory_has_default_acl(conn, parent_dir))) {
(def_acl = directory_has_default_acl(conn, parent_dir_fname))) {
unx_mode = (0777 & lp_create_mask(SNUM(conn)));
}

View File

@ -326,7 +326,8 @@ bool can_delete_file_in_directory(connection_struct *conn,
const struct smb_filename *smb_fname);
bool can_write_to_file(connection_struct *conn,
const struct smb_filename *smb_fname);
bool directory_has_default_acl(connection_struct *conn, const char *fname);
bool directory_has_default_acl(connection_struct *conn,
struct smb_filename *smb_fname);
NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode);
/* The following definitions come from smbd/fileio.c */