From: Ralph Boehme Date: Sun, 13 Dec 2020 07:55:39 +0000 (+0100) Subject: posixacl_xattr: add support for SMB_ACL_TYPE_DEFAULT in posixacl_xattr_acl_set_fd() X-Git-Tag: samba-4.14.0rc1~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=467dbdbdde30a8214200bf2be7674bbcb07460f8;p=thirdparty%2Fsamba.git posixacl_xattr: add support for SMB_ACL_TYPE_DEFAULT in posixacl_xattr_acl_set_fd() No need to handle pathref fsps here, as that is taken care of by SMB_VFS_FSETXATTR(). Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/posixacl_xattr.c b/source3/modules/posixacl_xattr.c index e88c6cecace..7582ceb121e 100644 --- a/source3/modules/posixacl_xattr.c +++ b/source3/modules/posixacl_xattr.c @@ -483,10 +483,20 @@ int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle, SMB_ACL_TYPE_T type, SMB_ACL_T theacl) { + const char *name = NULL; char *buf; ssize_t size; int ret; + if (type == SMB_ACL_TYPE_ACCESS) { + name = ACL_EA_ACCESS; + } else if (type == SMB_ACL_TYPE_DEFAULT) { + name = ACL_EA_DEFAULT; + } else { + errno = EINVAL; + return -1; + } + size = smb_acl_to_posixacl_xattr(theacl, NULL, 0); buf = alloca(size); if (!buf) { @@ -499,7 +509,7 @@ int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle, return -1; } - return SMB_VFS_FSETXATTR(fsp, ACL_EA_ACCESS, buf, size, 0); + return SMB_VFS_FSETXATTR(fsp, name, buf, size, 0); } int posixacl_xattr_acl_delete_def_file(vfs_handle_struct *handle,