From: Jeremy Allison Date: Wed, 9 Jun 2021 00:36:50 +0000 (-0700) Subject: s3: VFS: posixacl: Fix the fallback code in posixacl_sys_acl_set_fd(). X-Git-Tag: tevent-0.11.0~647 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=250a5df6bc6602f2ca7b39725b7c3c29f6e70853;p=thirdparty%2Fsamba.git s3: VFS: posixacl: Fix the fallback code in posixacl_sys_acl_set_fd(). We weren't maping or using the incoming SMB_ACL_TYPE_T type parameter correctly. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c index 4a3dc1b8258..534248a6b64 100644 --- a/source3/modules/vfs_posixacl.c +++ b/source3/modules/vfs_posixacl.c @@ -142,12 +142,26 @@ int posixacl_sys_acl_set_fd(vfs_handle_struct *handle, { int res; acl_t acl = smb_acl_to_posix(theacl); + acl_type_t acl_type; int fd = fsp_get_pathref_fd(fsp); if (acl == NULL) { return -1; } + switch(type) { + case SMB_ACL_TYPE_ACCESS: + acl_type = ACL_TYPE_ACCESS; + break; + case SMB_ACL_TYPE_DEFAULT: + acl_type = ACL_TYPE_DEFAULT; + break; + default: + acl_free(acl); + errno = EINVAL; + return -1; + } + if (!fsp->fsp_flags.is_pathref && type == SMB_ACL_TYPE_ACCESS) { res = acl_set_fd(fd, acl); } else if (fsp->fsp_flags.have_proc_fds) { @@ -159,13 +173,13 @@ int posixacl_sys_acl_set_fd(vfs_handle_struct *handle, acl_free(acl); return -1; } - res = acl_set_file(proc_fd_path, type, acl); + res = acl_set_file(proc_fd_path, acl_type, acl); } else { /* * This is no longer a handle based call. */ res = acl_set_file(fsp->fsp_name->base_name, - type, + acl_type, acl); }