s3-smbd: Call sys_acl_create_entry() directly rather than via the VFS
[vlendec/samba-autobuild/.git] / source3 / smbd / posix_acls.c
index f07f72ebb72ee20d22e8553c0a73a16374a82a69..79eb8aa09751a1531d1adcf28c7fa154b9d52280 100644 (file)
@@ -859,9 +859,9 @@ static mode_t convert_permset_to_mode_t(connection_struct *conn, SMB_ACL_PERMSET
 {
        mode_t ret = 0;
 
-       ret |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_READ) ? S_IRUSR : 0);
-       ret |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_WRITE) ? S_IWUSR : 0);
-       ret |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_EXECUTE) ? S_IXUSR : 0);
+       ret |= (sys_acl_get_perm(permset, SMB_ACL_READ) ? S_IRUSR : 0);
+       ret |= (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? S_IWUSR : 0);
+       ret |= (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? S_IXUSR : 0);
 
        return ret;
 }
@@ -891,18 +891,18 @@ static mode_t unix_perms_to_acl_perms(mode_t mode, int r_mask, int w_mask, int x
 
 static int map_acl_perms_to_permset(connection_struct *conn, mode_t mode, SMB_ACL_PERMSET_T *p_permset)
 {
-       if (SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, *p_permset) ==  -1)
+       if (sys_acl_clear_perms(*p_permset) ==  -1)
                return -1;
        if (mode & S_IRUSR) {
-               if (SMB_VFS_SYS_ACL_ADD_PERM(conn, *p_permset, SMB_ACL_READ) == -1)
+               if (sys_acl_add_perm(*p_permset, SMB_ACL_READ) == -1)
                        return -1;
        }
        if (mode & S_IWUSR) {
-               if (SMB_VFS_SYS_ACL_ADD_PERM(conn, *p_permset, SMB_ACL_WRITE) == -1)
+               if (sys_acl_add_perm(*p_permset, SMB_ACL_WRITE) == -1)
                        return -1;
        }
        if (mode & S_IXUSR) {
-               if (SMB_VFS_SYS_ACL_ADD_PERM(conn, *p_permset, SMB_ACL_EXECUTE) == -1)
+               if (sys_acl_add_perm(*p_permset, SMB_ACL_EXECUTE) == -1)
                        return -1;
        }
        return 0;
@@ -919,7 +919,7 @@ void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid,
 }
 
 /****************************************************************************
- Merge aces with a common sid - if both are allow or deny, OR the permissions together and
+ Merge aces with a common UID or GID - if both are allow or deny, OR the permissions together and
  delete the second one. If the first is deny, mask the permissions off and delete the allow
  if the permissions become zero, delete the deny if the permissions are non zero.
 ****************************************************************************/
@@ -955,11 +955,11 @@ static void merge_aces( canon_ace **pp_list_head, bool dir_acl)
                         */
 
                        if (!dir_acl) {
-                               can_merge = (dom_sid_equal(&curr_ace->trustee, &curr_ace_outer->trustee) &&
+                               can_merge = (curr_ace->unix_ug.id == curr_ace_outer->unix_ug.id &&
                                             curr_ace->owner_type == curr_ace_outer->owner_type &&
                                             (curr_ace->attr == curr_ace_outer->attr));
                        } else {
-                               can_merge = (dom_sid_equal(&curr_ace->trustee, &curr_ace_outer->trustee) &&
+                               can_merge = (curr_ace->unix_ug.id == curr_ace_outer->unix_ug.id &&
                                             curr_ace->owner_type == curr_ace_outer->owner_type &&
                                             (curr_ace->type == curr_ace_outer->type) &&
                                             (curr_ace->attr == curr_ace_outer->attr));
@@ -1009,7 +1009,7 @@ static void merge_aces( canon_ace **pp_list_head, bool dir_acl)
                         * we've put on the ACL, we know the deny must be the first one.
                         */
 
-                       if (dom_sid_equal(&curr_ace->trustee, &curr_ace_outer->trustee) &&
+                       if (curr_ace->unix_ug.id == curr_ace_outer->unix_ug.id &&
                            (curr_ace->owner_type == curr_ace_outer->owner_type) &&
                            (curr_ace_outer->attr == DENY_ACE) && (curr_ace->attr == ALLOW_ACE)) {
 
@@ -2631,7 +2631,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
        SMB_ACL_ENTRY_T entry;
        size_t ace_count;
 
-       while ( posix_acl && (SMB_VFS_SYS_ACL_GET_ENTRY(conn, posix_acl, entry_id, &entry) == 1)) {
+       while ( posix_acl && (sys_acl_get_entry(posix_acl, entry_id, &entry) == 1)) {
                SMB_ACL_TAG_T tagtype;
                SMB_ACL_PERMSET_T permset;
                struct dom_sid sid;
@@ -2641,10 +2641,10 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
                entry_id = SMB_ACL_NEXT_ENTRY;
 
                /* Is this a MASK entry ? */
-               if (SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry, &tagtype) == -1)
+               if (sys_acl_get_tag_type(entry, &tagtype) == -1)
                        continue;
 
-               if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry, &permset) == -1)
+               if (sys_acl_get_permset(entry, &permset) == -1)
                        continue;
 
                /* Decide which SID to use based on the ACL type. */
@@ -2658,7 +2658,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
                                break;
                        case SMB_ACL_USER:
                                {
-                                       uid_t *puid = (uid_t *)SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry);
+                                       uid_t *puid = (uid_t *)sys_acl_get_qualifier(entry);
                                        if (puid == NULL) {
                                                DEBUG(0,("canonicalise_acl: Failed to get uid.\n"));
                                                continue;
@@ -2667,7 +2667,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
                                        unix_ug.type = ID_TYPE_UID;
                                        unix_ug.id = *puid;
                                        owner_type = UID_ACE;
-                                       SMB_VFS_SYS_ACL_FREE_QUALIFIER(conn, (void *)puid,tagtype);
+                                       sys_acl_free_qualifier((void *)puid,tagtype);
                                        break;
                                }
                        case SMB_ACL_GROUP_OBJ:
@@ -2679,7 +2679,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
                                break;
                        case SMB_ACL_GROUP:
                                {
-                                       gid_t *pgid = (gid_t *)SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry);
+                                       gid_t *pgid = (gid_t *)sys_acl_get_qualifier(entry);
                                        if (pgid == NULL) {
                                                DEBUG(0,("canonicalise_acl: Failed to get gid.\n"));
                                                continue;
@@ -2688,7 +2688,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
                                        unix_ug.type = ID_TYPE_GID;
                                        unix_ug.id = *pgid;
                                        owner_type = GID_ACE;
-                                       SMB_VFS_SYS_ACL_FREE_QUALIFIER(conn, (void *)pgid,tagtype);
+                                       sys_acl_free_qualifier((void *)pgid,tagtype);
                                        break;
                                }
                        case SMB_ACL_MASK:
@@ -2825,7 +2825,7 @@ static bool set_canon_ace_list(files_struct *fsp,
 {
        connection_struct *conn = fsp->conn;
        bool ret = False;
-       SMB_ACL_T the_acl = SMB_VFS_SYS_ACL_INIT(conn, (int)count_canon_ace_list(the_ace) + 1);
+       SMB_ACL_T the_acl = sys_acl_init(count_canon_ace_list(the_ace) + 1);
        canon_ace *p_ace;
        int i;
        SMB_ACL_ENTRY_T mask_entry;
@@ -2888,7 +2888,7 @@ static bool set_canon_ace_list(files_struct *fsp,
                 * Get the entry for this ACE.
                 */
 
-               if (SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, &the_acl, &the_entry) == -1) {
+               if (sys_acl_create_entry(&the_acl, &the_entry) == -1) {
                        DEBUG(0,("set_canon_ace_list: Failed to create entry %d. (%s)\n",
                                i, strerror(errno) ));
                        goto fail;
@@ -2937,7 +2937,7 @@ static bool set_canon_ace_list(files_struct *fsp,
                 * Convert the mode_t perms in the canon_ace to a POSIX permset.
                 */
 
-               if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, the_entry, &the_permset) == -1) {
+               if (sys_acl_get_permset(the_entry, &the_permset) == -1) {
                        DEBUG(0,("set_canon_ace_list: Failed to get permset on entry %d. (%s)\n",
                                i, strerror(errno) ));
                        goto fail;
@@ -2965,7 +2965,7 @@ static bool set_canon_ace_list(files_struct *fsp,
        }
 
        if (needs_mask && !got_mask_entry) {
-               if (SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, &the_acl, &mask_entry) == -1) {
+               if (sys_acl_create_entry(&the_acl, &mask_entry) == -1) {
                        DEBUG(0,("set_canon_ace_list: Failed to create mask entry. (%s)\n", strerror(errno) ));
                        goto fail;
                }
@@ -2975,7 +2975,7 @@ static bool set_canon_ace_list(files_struct *fsp,
                        goto fail;
                }
 
-               if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, mask_entry, &mask_permset) == -1) {
+               if (sys_acl_get_permset(mask_entry, &mask_permset) == -1) {
                        DEBUG(0,("set_canon_ace_list: Failed to get mask permset. (%s)\n", strerror(errno) ));
                        goto fail;
                }
@@ -3075,7 +3075,7 @@ static bool set_canon_ace_list(files_struct *fsp,
   fail:
 
        if (the_acl != NULL) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, the_acl);
+               sys_acl_free_acl(the_acl);
        }
 
        return ret;
@@ -3107,8 +3107,8 @@ SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl)
 
        if (!the_acl)
                return NULL;
-       if (SMB_VFS_SYS_ACL_GET_ENTRY(conn, the_acl, SMB_ACL_FIRST_ENTRY, &entry) != 1) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, the_acl);
+       if (sys_acl_get_entry(the_acl, SMB_ACL_FIRST_ENTRY, &entry) != 1) {
+               sys_acl_free_acl(the_acl);
                return NULL;
        }
        return the_acl;
@@ -3557,10 +3557,10 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
  done:
 
        if (posix_acl) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl);
+               sys_acl_free_acl(posix_acl);
        }
        if (def_acl) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, def_acl);
+               sys_acl_free_acl(def_acl);
        }
        free_canon_ace_list(file_ace);
        free_canon_ace_list(dir_ace);
@@ -4276,29 +4276,29 @@ int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode
        if (posix_acl == (SMB_ACL_T)NULL)
                return -1;
 
-       while (SMB_VFS_SYS_ACL_GET_ENTRY(conn, posix_acl, entry_id, &entry) == 1) {
+       while (sys_acl_get_entry(posix_acl, entry_id, &entry) == 1) {
                SMB_ACL_TAG_T tagtype;
                SMB_ACL_PERMSET_T permset;
 
                entry_id = SMB_ACL_NEXT_ENTRY;
 
-               if (SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry, &tagtype) ==-1)
+               if (sys_acl_get_tag_type(entry, &tagtype) ==-1)
                        break;
 
                if (tagtype == SMB_ACL_GROUP_OBJ) {
-                       if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry, &permset) == -1) {
+                       if (sys_acl_get_permset(entry, &permset) == -1) {
                                break;
                        } else {
                                *mode &= ~(S_IRGRP|S_IWGRP|S_IXGRP);
-                               *mode |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_READ) ? S_IRGRP : 0);
-                               *mode |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_WRITE) ? S_IWGRP : 0);
-                               *mode |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_EXECUTE) ? S_IXGRP : 0);
+                               *mode |= (sys_acl_get_perm(permset, SMB_ACL_READ) ? S_IRGRP : 0);
+                               *mode |= (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? S_IWGRP : 0);
+                               *mode |= (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? S_IXGRP : 0);
                                result = 0;
                                break;
                        }
                }
        }
-       SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl);
+       sys_acl_free_acl(posix_acl);
        return result;
 }
 
@@ -4313,17 +4313,17 @@ static int chmod_acl_internals( connection_struct *conn, SMB_ACL_T posix_acl, mo
        SMB_ACL_ENTRY_T entry;
        int num_entries = 0;
 
-       while ( SMB_VFS_SYS_ACL_GET_ENTRY(conn, posix_acl, entry_id, &entry) == 1) {
+       while ( sys_acl_get_entry(posix_acl, entry_id, &entry) == 1) {
                SMB_ACL_TAG_T tagtype;
                SMB_ACL_PERMSET_T permset;
                mode_t perms;
 
                entry_id = SMB_ACL_NEXT_ENTRY;
 
-               if (SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry, &tagtype) == -1)
+               if (sys_acl_get_tag_type(entry, &tagtype) == -1)
                        return -1;
 
-               if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry, &permset) == -1)
+               if (sys_acl_get_permset(entry, &permset) == -1)
                        return -1;
 
                num_entries++;
@@ -4390,7 +4390,7 @@ static int copy_access_posix_acl(connection_struct *conn, const char *from, cons
 
  done:
 
-       SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl);
+       sys_acl_free_acl(posix_acl);
        return ret;
 }
 
@@ -4415,12 +4415,12 @@ static bool directory_has_default_posix_acl(connection_struct *conn, const char
        bool has_acl = False;
        SMB_ACL_ENTRY_T entry;
 
-       if (def_acl != NULL && (SMB_VFS_SYS_ACL_GET_ENTRY(conn, def_acl, SMB_ACL_FIRST_ENTRY, &entry) == 1)) {
+       if (def_acl != NULL && (sys_acl_get_entry(def_acl, SMB_ACL_FIRST_ENTRY, &entry) == 1)) {
                has_acl = True;
        }
 
        if (def_acl) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, def_acl);
+               sys_acl_free_acl(def_acl);
        }
         return has_acl;
 }
@@ -4460,7 +4460,7 @@ int fchmod_acl(files_struct *fsp, mode_t mode)
 
   done:
 
-       SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl);
+       sys_acl_free_acl(posix_acl);
        return ret;
 }
 
@@ -4474,22 +4474,22 @@ static bool unix_ex_wire_to_permset(connection_struct *conn, unsigned char wire_
                return False;
        }
 
-       if (SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, *p_permset) ==  -1) {
+       if (sys_acl_clear_perms(*p_permset) ==  -1) {
                return False;
        }
 
        if (wire_perm & SMB_POSIX_ACL_READ) {
-               if (SMB_VFS_SYS_ACL_ADD_PERM(conn, *p_permset, SMB_ACL_READ) == -1) {
+               if (sys_acl_add_perm(*p_permset, SMB_ACL_READ) == -1) {
                        return False;
                }
        }
        if (wire_perm & SMB_POSIX_ACL_WRITE) {
-               if (SMB_VFS_SYS_ACL_ADD_PERM(conn, *p_permset, SMB_ACL_WRITE) == -1) {
+               if (sys_acl_add_perm(*p_permset, SMB_ACL_WRITE) == -1) {
                        return False;
                }
        }
        if (wire_perm & SMB_POSIX_ACL_EXECUTE) {
-               if (SMB_VFS_SYS_ACL_ADD_PERM(conn, *p_permset, SMB_ACL_EXECUTE) == -1) {
+               if (sys_acl_add_perm(*p_permset, SMB_ACL_EXECUTE) == -1) {
                        return False;
                }
        }
@@ -4535,7 +4535,7 @@ static bool unix_ex_wire_to_tagtype(unsigned char wire_tt, SMB_ACL_TAG_T *p_tt)
 static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn, uint16 num_acls, const char *pdata)
 {
        unsigned int i;
-       SMB_ACL_T the_acl = SMB_VFS_SYS_ACL_INIT(conn, num_acls);
+       SMB_ACL_T the_acl = sys_acl_init(num_acls);
 
        if (the_acl == NULL) {
                return NULL;
@@ -4546,7 +4546,7 @@ static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn, uint16 num_
                SMB_ACL_PERMSET_T the_permset;
                SMB_ACL_TAG_T tag_type;
 
-               if (SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, &the_acl, &the_entry) == -1) {
+               if (sys_acl_create_entry(&the_acl, &the_entry) == -1) {
                        DEBUG(0,("create_posix_acl_from_wire: Failed to create entry %u. (%s)\n",
                                i, strerror(errno) ));
                        goto fail;
@@ -4565,7 +4565,7 @@ static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn, uint16 num_
                }
 
                /* Get the permset pointer from the new ACL entry. */
-               if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, the_entry, &the_permset) == -1) {
+               if (sys_acl_get_permset(the_entry, &the_permset) == -1) {
                        DEBUG(0,("create_posix_acl_from_wire: Failed to get permset on entry %u. (%s)\n",
                                 i, strerror(errno) ));
                         goto fail;
@@ -4611,7 +4611,7 @@ static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn, uint16 num_
  fail:
 
        if (the_acl != NULL) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, the_acl);
+               sys_acl_free_acl(the_acl);
        }
        return NULL;
 }
@@ -4655,12 +4655,12 @@ bool set_unix_posix_default_acl(connection_struct *conn, const char *fname, cons
        if (SMB_VFS_SYS_ACL_SET_FILE(conn, fname, SMB_ACL_TYPE_DEFAULT, def_acl) == -1) {
                DEBUG(5,("set_unix_posix_default_acl: acl_set_file failed on directory %s (%s)\n",
                        fname, strerror(errno) ));
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, def_acl);
+               sys_acl_free_acl(def_acl);
                return False;
        }
 
        DEBUG(10,("set_unix_posix_default_acl: set default acl for file %s\n", fname ));
-       SMB_VFS_SYS_ACL_FREE_ACL(conn, def_acl);
+       sys_acl_free_acl(def_acl);
        return True;
 }
 
@@ -4679,7 +4679,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
        SMB_ACL_ENTRY_T entry;
        bool ret = False;
        /* Create a new ACL with only 3 entries, u/g/w. */
-       SMB_ACL_T new_file_acl = SMB_VFS_SYS_ACL_INIT(conn, 3);
+       SMB_ACL_T new_file_acl = sys_acl_init(3);
        SMB_ACL_ENTRY_T user_ent = NULL;
        SMB_ACL_ENTRY_T group_ent = NULL;
        SMB_ACL_ENTRY_T other_ent = NULL;
@@ -4690,7 +4690,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
        }
 
        /* Now create the u/g/w entries. */
-       if (SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, &new_file_acl, &user_ent) == -1) {
+       if (sys_acl_create_entry(&new_file_acl, &user_ent) == -1) {
                DEBUG(5,("remove_posix_acl: Failed to create user entry for file %s. (%s)\n",
                        fname, strerror(errno) ));
                goto done;
@@ -4701,7 +4701,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
                goto done;
        }
 
-       if (SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, &new_file_acl, &group_ent) == -1) {
+       if (sys_acl_create_entry(&new_file_acl, &group_ent) == -1) {
                DEBUG(5,("remove_posix_acl: Failed to create group entry for file %s. (%s)\n",
                        fname, strerror(errno) ));
                goto done;
@@ -4712,7 +4712,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
                goto done;
        }
 
-       if (SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, &new_file_acl, &other_ent) == -1) {
+       if (sys_acl_create_entry(&new_file_acl, &other_ent) == -1) {
                DEBUG(5,("remove_posix_acl: Failed to create other entry for file %s. (%s)\n",
                        fname, strerror(errno) ));
                goto done;
@@ -4738,19 +4738,19 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
                goto done;
        }
 
-       while ( SMB_VFS_SYS_ACL_GET_ENTRY(conn, file_acl, entry_id, &entry) == 1) {
+       while ( sys_acl_get_entry(file_acl, entry_id, &entry) == 1) {
                SMB_ACL_TAG_T tagtype;
                SMB_ACL_PERMSET_T permset;
 
                entry_id = SMB_ACL_NEXT_ENTRY;
 
-               if (SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry, &tagtype) == -1) {
+               if (sys_acl_get_tag_type(entry, &tagtype) == -1) {
                        DEBUG(5,("remove_posix_acl: failed to get tagtype from ACL on file %s (%s).\n",
                                fname, strerror(errno) ));
                        goto done;
                }
 
-               if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry, &permset) == -1) {
+               if (sys_acl_get_permset(entry, &permset) == -1) {
                        DEBUG(5,("remove_posix_acl: failed to get permset from ACL on file %s (%s).\n",
                                fname, strerror(errno) ));
                        goto done;
@@ -4794,10 +4794,10 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c
  done:
 
        if (file_acl) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl);
+               sys_acl_free_acl(file_acl);
        }
        if (new_file_acl) {
-               SMB_VFS_SYS_ACL_FREE_ACL(conn, new_file_acl);
+               sys_acl_free_acl(new_file_acl);
        }
        return ret;
 }
@@ -4826,20 +4826,20 @@ bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *
                if (SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl) == -1) {
                        DEBUG(5,("set_unix_posix_acl: acl_set_file failed on %s (%s)\n",
                                fname, strerror(errno) ));
-                       SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl);
+                       sys_acl_free_acl(file_acl);
                        return False;
                }
        } else {
                if (SMB_VFS_SYS_ACL_SET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS, file_acl) == -1) {
                        DEBUG(5,("set_unix_posix_acl: acl_set_file failed on %s (%s)\n",
                                fname, strerror(errno) ));
-                       SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl);
+                       sys_acl_free_acl(file_acl);
                        return False;
                }
        }
 
        DEBUG(10,("set_unix_posix_acl: set acl for file %s\n", fname ));
-       SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl);
+       sys_acl_free_acl(file_acl);
        return True;
 }