]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_solarisacl: add support for SMB_ACL_TYPE_DEFAULT in solarisacl_sys_acl_set_fd()
authorRalph Boehme <slow@samba.org>
Mon, 14 Dec 2020 07:05:53 +0000 (08:05 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 17 Dec 2020 18:56:28 +0000 (18:56 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_solarisacl.c

index 41a2dd363d86db571cd97628934098d1f107fd18..ae91499a34b13ecd6e69dad6909b5a28285be966 100644 (file)
@@ -241,8 +241,10 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              SMB_ACL_T theacl)
 {
        SOLARIS_ACL_T solaris_acl = NULL;
-       SOLARIS_ACL_T default_acl = NULL;
-       int count, default_count;
+       int count;
+       SOLARIS_ACL_T other_acl = NULL;
+       int other_count;
+       SMB_ACL_TYPE_T other_type;
        int ret = -1;
 
        DEBUG(10, ("entering solarisacl_sys_acl_set_fd\n"));
@@ -255,19 +257,24 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
         * concatenate it with the access acl provided.
         */
        if (!smb_acl_to_solaris_acl(theacl, &solaris_acl, &count, 
-                                   SMB_ACL_TYPE_ACCESS))
+                                   type))
        {
                DEBUG(10, ("conversion smb_acl -> solaris_acl failed (%s).\n",
                           strerror(errno)));
                goto done;
        }
-       if (!solaris_acl_get_fd(fsp_get_io_fd(fsp), &default_acl, &default_count)) {
+       if (!solaris_acl_get_fd(fsp_get_io_fd(fsp), &other_acl, &other_count)) {
                DEBUG(10, ("error getting (default) acl from fd\n"));
                goto done;
        }
+
+       other_type = (type == SMB_ACL_TYPE_ACCESS)
+               ? SMB_ACL_TYPE_DEFAULT
+               : SMB_ACL_TYPE_ACCESS;
+
        if (!solaris_add_to_acl(&solaris_acl, &count,
-                               default_acl, default_count,
-                               SMB_ACL_TYPE_DEFAULT))
+                               other_acl, other_count,
+                               other_type))
        {
                DEBUG(10, ("error adding default acl to solaris acl\n"));
                goto done;