]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
posixacl_xattr: add support for SMB_ACL_TYPE_DEFAULT in posixacl_xattr_acl_set_fd()
authorRalph Boehme <slow@samba.org>
Sun, 13 Dec 2020 07:55:39 +0000 (08:55 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 17 Dec 2020 18:56:28 +0000 (18:56 +0000)
No need to handle pathref fsps here, as that is taken care of by
SMB_VFS_FSETXATTR().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/posixacl_xattr.c

index e88c6cecacec366f67decc5354340d9168037c2a..7582ceb121e1651984351f92e188b324fef0487d 100644 (file)
@@ -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,