2 * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
38 #include "xfs_alloc_btree.h"
39 #include "xfs_bmap_btree.h"
40 #include "xfs_ialloc_btree.h"
41 #include "xfs_btree.h"
42 #include "xfs_attr_sf.h"
43 #include "xfs_dir_sf.h"
44 #include "xfs_dir2_sf.h"
45 #include "xfs_dinode.h"
46 #include "xfs_inode.h"
51 #include <linux/posix_acl_xattr.h>
53 STATIC
int xfs_acl_setmode(vnode_t
*, xfs_acl_t
*, int *);
54 STATIC
void xfs_acl_filter_mode(mode_t
, xfs_acl_t
*);
55 STATIC
void xfs_acl_get_endian(xfs_acl_t
*);
56 STATIC
int xfs_acl_access(uid_t
, gid_t
, xfs_acl_t
*, mode_t
, cred_t
*);
57 STATIC
int xfs_acl_invalid(xfs_acl_t
*);
58 STATIC
void xfs_acl_sync_mode(mode_t
, xfs_acl_t
*);
59 STATIC
void xfs_acl_get_attr(vnode_t
*, xfs_acl_t
*, int, int, int *);
60 STATIC
void xfs_acl_set_attr(vnode_t
*, xfs_acl_t
*, int, int *);
61 STATIC
int xfs_acl_allow_set(vnode_t
*, int);
63 kmem_zone_t
*xfs_acl_zone
;
67 * Test for existence of access ACL attribute as efficiently as possible.
70 xfs_acl_vhasacl_access(
75 xfs_acl_get_attr(vp
, NULL
, _ACL_TYPE_ACCESS
, ATTR_KERNOVAL
, &error
);
80 * Test for existence of default ACL attribute as efficiently as possible.
83 xfs_acl_vhasacl_default(
88 if (vp
->v_type
!= VDIR
)
90 xfs_acl_get_attr(vp
, NULL
, _ACL_TYPE_DEFAULT
, ATTR_KERNOVAL
, &error
);
95 * Convert from extended attribute representation to in-memory for XFS.
98 posix_acl_xattr_to_xfs(
99 posix_acl_xattr_header
*src
,
103 posix_acl_xattr_entry
*src_entry
;
104 xfs_acl_entry_t
*dest_entry
;
110 if (size
< sizeof(posix_acl_xattr_header
))
113 if (src
->a_version
!= cpu_to_le32(POSIX_ACL_XATTR_VERSION
))
116 memset(dest
, 0, sizeof(xfs_acl_t
));
117 dest
->acl_cnt
= posix_acl_xattr_count(size
);
118 if (dest
->acl_cnt
< 0 || dest
->acl_cnt
> XFS_ACL_MAX_ENTRIES
)
122 * acl_set_file(3) may request that we set default ACLs with
123 * zero length -- defend (gracefully) against that here.
128 src_entry
= (posix_acl_xattr_entry
*)((char *)src
+ sizeof(*src
));
129 dest_entry
= &dest
->acl_entry
[0];
131 for (n
= 0; n
< dest
->acl_cnt
; n
++, src_entry
++, dest_entry
++) {
132 dest_entry
->ae_perm
= le16_to_cpu(src_entry
->e_perm
);
133 if (_ACL_PERM_INVALID(dest_entry
->ae_perm
))
135 dest_entry
->ae_tag
= le16_to_cpu(src_entry
->e_tag
);
136 switch(dest_entry
->ae_tag
) {
139 dest_entry
->ae_id
= le32_to_cpu(src_entry
->e_id
);
145 dest_entry
->ae_id
= ACL_UNDEFINED_ID
;
151 if (xfs_acl_invalid(dest
))
158 * Comparison function called from qsort().
159 * Primary key is ae_tag, secondary key is ae_id.
162 xfs_acl_entry_compare(
166 xfs_acl_entry_t
*a
= (xfs_acl_entry_t
*)va
,
167 *b
= (xfs_acl_entry_t
*)vb
;
169 if (a
->ae_tag
== b
->ae_tag
)
170 return (a
->ae_id
- b
->ae_id
);
171 return (a
->ae_tag
- b
->ae_tag
);
175 * Convert from in-memory XFS to extended attribute representation.
178 posix_acl_xfs_to_xattr(
180 posix_acl_xattr_header
*dest
,
184 size_t new_size
= posix_acl_xattr_size(src
->acl_cnt
);
185 posix_acl_xattr_entry
*dest_entry
;
186 xfs_acl_entry_t
*src_entry
;
191 /* Need to sort src XFS ACL by <ae_tag,ae_id> */
192 qsort(src
->acl_entry
, src
->acl_cnt
, sizeof(src
->acl_entry
[0]),
193 xfs_acl_entry_compare
);
195 dest
->a_version
= cpu_to_le32(POSIX_ACL_XATTR_VERSION
);
196 dest_entry
= &dest
->a_entries
[0];
197 src_entry
= &src
->acl_entry
[0];
198 for (n
= 0; n
< src
->acl_cnt
; n
++, dest_entry
++, src_entry
++) {
199 dest_entry
->e_perm
= cpu_to_le16(src_entry
->ae_perm
);
200 if (_ACL_PERM_INVALID(src_entry
->ae_perm
))
202 dest_entry
->e_tag
= cpu_to_le16(src_entry
->ae_tag
);
203 switch (src_entry
->ae_tag
) {
206 dest_entry
->e_id
= cpu_to_le32(src_entry
->ae_id
);
212 dest_entry
->e_id
= cpu_to_le32(ACL_UNDEFINED_ID
);
229 xfs_acl_t
*xfs_acl
= NULL
;
230 posix_acl_xattr_header
*ext_acl
= acl
;
235 if (!(_ACL_ALLOC(xfs_acl
))) {
239 memset(xfs_acl
, 0, sizeof(xfs_acl_t
));
241 flags
= ATTR_KERNOVAL
;
243 xfs_acl_get_attr(vp
, xfs_acl
, kind
, flags
, &error
);
248 error
= -posix_acl_xattr_size(XFS_ACL_MAX_ENTRIES
);
250 if (xfs_acl_invalid(xfs_acl
)) {
254 if (kind
== _ACL_TYPE_ACCESS
) {
257 va
.va_mask
= XFS_AT_MODE
;
258 VOP_GETATTR(vp
, &va
, 0, sys_cred
, error
);
261 xfs_acl_sync_mode(va
.va_mode
, xfs_acl
);
263 error
= -posix_acl_xfs_to_xattr(xfs_acl
, ext_acl
, size
);
280 error
= xfs_acl_allow_set(vp
, kind
);
282 VOP_ATTR_REMOVE(vp
, kind
== _ACL_TYPE_DEFAULT
?
283 SGI_ACL_DEFAULT
: SGI_ACL_FILE
,
284 ATTR_ROOT
, sys_cred
, error
);
285 if (error
== ENOATTR
)
286 error
= 0; /* 'scool */
299 posix_acl_xattr_header
*ext_acl
= acl
;
302 int basicperms
= 0; /* more than std unix perms? */
307 if (!(_ACL_ALLOC(xfs_acl
)))
310 error
= posix_acl_xattr_to_xfs(ext_acl
, size
, xfs_acl
);
315 if (!xfs_acl
->acl_cnt
) {
321 error
= xfs_acl_allow_set(vp
, kind
);
325 /* Incoming ACL exists, set file mode based on its value */
326 if (kind
== _ACL_TYPE_ACCESS
)
327 xfs_acl_setmode(vp
, xfs_acl
, &basicperms
);
330 * If we have more than std unix permissions, set up the actual attr.
331 * Otherwise, delete any existing attr. This prevents us from
332 * having actual attrs for permissions that can be stored in the
333 * standard permission bits.
336 xfs_acl_set_attr(vp
, xfs_acl
, kind
, &error
);
338 xfs_acl_vremove(vp
, _ACL_TYPE_ACCESS
);
356 if (!(_ACL_ALLOC(acl
)))
359 /* If the file has no ACL return -1. */
360 rval
= sizeof(xfs_acl_t
);
361 if (xfs_attr_fetch(ip
, SGI_ACL_FILE
, SGI_ACL_FILE_SIZE
,
362 (char *)acl
, &rval
, ATTR_ROOT
| ATTR_KERNACCESS
, cr
)) {
366 xfs_acl_get_endian(acl
);
368 /* If the file has an empty ACL return -1. */
369 if (acl
->acl_cnt
== XFS_ACL_NOT_PRESENT
) {
374 /* Synchronize ACL with mode bits */
375 xfs_acl_sync_mode(ip
->i_d
.di_mode
, acl
);
377 rval
= xfs_acl_access(ip
->i_d
.di_uid
, ip
->i_d
.di_gid
, acl
, mode
, cr
);
390 if (vp
->v_inode
.i_flags
& (S_IMMUTABLE
|S_APPEND
))
392 if (kind
== _ACL_TYPE_DEFAULT
&& vp
->v_type
!= VDIR
)
394 if (vp
->v_vfsp
->vfs_flag
& VFS_RDONLY
)
396 va
.va_mask
= XFS_AT_UID
;
397 VOP_GETATTR(vp
, &va
, 0, NULL
, error
);
400 if (va
.va_uid
!= current
->fsuid
&& !capable(CAP_FOWNER
))
406 * Look for any effective exec access, to allow CAP_DAC_OVERRIDE for exec.
407 * Ignore checking for exec in USER_OBJ when there is no mask, because
408 * in this "minimal acl" case we don't have any actual acls, and we
409 * won't even be here.
412 xfs_acl_find_any_exec(
419 for (i
= 0; i
< fap
->acl_cnt
; i
++) {
420 if (fap
->acl_entry
[i
].ae_perm
& ACL_EXECUTE
) {
421 if (fap
->acl_entry
[i
].ae_tag
& (ACL_USER_OBJ
|ACL_OTHER
))
424 if (fap
->acl_entry
[i
].ae_tag
== ACL_MASK
)
425 mask
= fap
->acl_entry
[i
].ae_perm
;
427 masked_aces
|= fap
->acl_entry
[i
].ae_perm
;
429 if ((mask
& masked_aces
) & ACL_EXECUTE
)
438 * The access control process to determine the access permission:
439 * if uid == file owner id, use the file owner bits.
440 * if gid == file owner group id, use the file group bits.
441 * scan ACL for a maching user or group, and use matched entry
442 * permission. Use total permissions of all matching group entries,
443 * until all acl entries are exhausted. The final permission produced
444 * by matching acl entry or entries needs to be & with group permission.
445 * if not owner, owning group, or matching entry in ACL, use file
446 * other bits. Don't allow CAP_DAC_OVERRIDE on exec access unless
447 * there is some effective exec access somewhere.
450 xfs_acl_capability_check(
455 if ((mode
& ACL_READ
) && !capable_cred(cr
, CAP_DAC_READ_SEARCH
))
457 if ((mode
& ACL_WRITE
) && !capable_cred(cr
, CAP_DAC_OVERRIDE
))
459 if ((mode
& ACL_EXECUTE
) &&
460 (!capable_cred(cr
, CAP_DAC_OVERRIDE
) ||
461 !xfs_acl_find_any_exec(fap
))) {
469 * Note: cr is only used here for the capability check if the ACL test fails.
470 * It is not used to find out the credentials uid or groups etc, as was
471 * done in IRIX. It is assumed that the uid and groups for the current
472 * thread are taken from "current" instead of the cr parameter.
482 xfs_acl_entry_t matched
;
484 int maskallows
= -1; /* true, but not 1, either */
485 int seen_userobj
= 0;
487 matched
.ae_tag
= 0; /* Invalid type */
488 md
>>= 6; /* Normalize the bits for comparison */
490 for (i
= 0; i
< fap
->acl_cnt
; i
++) {
492 * Break out if we've got a user_obj entry or
493 * a user entry and the mask (and have processed USER_OBJ)
495 if (matched
.ae_tag
== ACL_USER_OBJ
)
497 if (matched
.ae_tag
== ACL_USER
) {
498 if (maskallows
!= -1 && seen_userobj
)
500 if (fap
->acl_entry
[i
].ae_tag
!= ACL_MASK
&&
501 fap
->acl_entry
[i
].ae_tag
!= ACL_USER_OBJ
)
504 /* True if this entry allows the requested access */
505 allows
= ((fap
->acl_entry
[i
].ae_perm
& md
) == md
);
507 switch (fap
->acl_entry
[i
].ae_tag
) {
510 if (fuid
!= current
->fsuid
)
512 matched
.ae_tag
= ACL_USER_OBJ
;
513 matched
.ae_perm
= allows
;
516 if (fap
->acl_entry
[i
].ae_id
!= current
->fsuid
)
518 matched
.ae_tag
= ACL_USER
;
519 matched
.ae_perm
= allows
;
522 if ((matched
.ae_tag
== ACL_GROUP_OBJ
||
523 matched
.ae_tag
== ACL_GROUP
) && !allows
)
525 if (!in_group_p(fgid
))
527 matched
.ae_tag
= ACL_GROUP_OBJ
;
528 matched
.ae_perm
= allows
;
531 if ((matched
.ae_tag
== ACL_GROUP_OBJ
||
532 matched
.ae_tag
== ACL_GROUP
) && !allows
)
534 if (!in_group_p(fap
->acl_entry
[i
].ae_id
))
536 matched
.ae_tag
= ACL_GROUP
;
537 matched
.ae_perm
= allows
;
543 if (matched
.ae_tag
!= 0)
545 matched
.ae_tag
= ACL_OTHER
;
546 matched
.ae_perm
= allows
;
551 * First possibility is that no matched entry allows access.
552 * The capability to override DAC may exist, so check for it.
554 switch (matched
.ae_tag
) {
563 if (maskallows
&& matched
.ae_perm
)
570 return xfs_acl_capability_check(md
, cr
, fap
);
574 * ACL validity checker.
575 * This acl validation routine checks each ACL entry read in makes sense.
581 xfs_acl_entry_t
*entry
, *e
;
582 int user
= 0, group
= 0, other
= 0, mask
= 0;
583 int mask_required
= 0;
589 if (aclp
->acl_cnt
> XFS_ACL_MAX_ENTRIES
)
592 for (i
= 0; i
< aclp
->acl_cnt
; i
++) {
593 entry
= &aclp
->acl_entry
[i
];
594 switch (entry
->ae_tag
) {
609 for (j
= i
+ 1; j
< aclp
->acl_cnt
; j
++) {
610 e
= &aclp
->acl_entry
[j
];
611 if (e
->ae_id
== entry
->ae_id
&&
612 e
->ae_tag
== entry
->ae_tag
)
625 if (!user
|| !group
|| !other
|| (mask_required
&& !mask
))
634 * Do ACL endian conversion.
640 xfs_acl_entry_t
*ace
, *end
;
642 INT_SET(aclp
->acl_cnt
, ARCH_CONVERT
, aclp
->acl_cnt
);
643 end
= &aclp
->acl_entry
[0]+aclp
->acl_cnt
;
644 for (ace
= &aclp
->acl_entry
[0]; ace
< end
; ace
++) {
645 INT_SET(ace
->ae_tag
, ARCH_CONVERT
, ace
->ae_tag
);
646 INT_SET(ace
->ae_id
, ARCH_CONVERT
, ace
->ae_id
);
647 INT_SET(ace
->ae_perm
, ARCH_CONVERT
, ace
->ae_perm
);
652 * Get the ACL from the EA and do endian conversion.
662 int len
= sizeof(xfs_acl_t
);
664 ASSERT((flags
& ATTR_KERNOVAL
) ? (aclp
== NULL
) : 1);
667 kind
== _ACL_TYPE_ACCESS
? SGI_ACL_FILE
: SGI_ACL_DEFAULT
,
668 (char *)aclp
, &len
, flags
, sys_cred
, *error
);
669 if (*error
|| (flags
& ATTR_KERNOVAL
))
671 xfs_acl_get_endian(aclp
);
675 * Set the EA with the ACL and do endian conversion.
684 xfs_acl_entry_t
*ace
, *newace
, *end
;
688 if (!(_ACL_ALLOC(newacl
))) {
693 len
= sizeof(xfs_acl_t
) -
694 (sizeof(xfs_acl_entry_t
) * (XFS_ACL_MAX_ENTRIES
- aclp
->acl_cnt
));
695 end
= &aclp
->acl_entry
[0]+aclp
->acl_cnt
;
696 for (ace
= &aclp
->acl_entry
[0], newace
= &newacl
->acl_entry
[0];
699 INT_SET(newace
->ae_tag
, ARCH_CONVERT
, ace
->ae_tag
);
700 INT_SET(newace
->ae_id
, ARCH_CONVERT
, ace
->ae_id
);
701 INT_SET(newace
->ae_perm
, ARCH_CONVERT
, ace
->ae_perm
);
703 INT_SET(newacl
->acl_cnt
, ARCH_CONVERT
, aclp
->acl_cnt
);
705 kind
== _ACL_TYPE_ACCESS
? SGI_ACL_FILE
: SGI_ACL_DEFAULT
,
706 (char *)newacl
, len
, ATTR_ROOT
, sys_cred
, *error
);
713 xfs_acl_t
*access_acl
,
714 xfs_acl_t
*default_acl
)
721 * Get the Access ACL and the mode. If either cannot
722 * be obtained for some reason, invalidate the access ACL.
724 xfs_acl_get_attr(vp
, access_acl
, _ACL_TYPE_ACCESS
, 0, &error
);
726 /* Got the ACL, need the mode... */
727 va
.va_mask
= XFS_AT_MODE
;
728 VOP_GETATTR(vp
, &va
, 0, sys_cred
, error
);
732 access_acl
->acl_cnt
= XFS_ACL_NOT_PRESENT
;
733 else /* We have a good ACL and the file mode, synchronize. */
734 xfs_acl_sync_mode(va
.va_mode
, access_acl
);
738 xfs_acl_get_attr(vp
, default_acl
, _ACL_TYPE_DEFAULT
, 0, &error
);
740 default_acl
->acl_cnt
= XFS_ACL_NOT_PRESENT
;
746 * This function retrieves the parent directory's acl, processes it
747 * and lets the child inherit the acl(s) that it should.
760 * If the parent does not have a default ACL, or it's an
761 * invalid ACL, we're done.
765 if (!pdaclp
|| xfs_acl_invalid(pdaclp
))
769 * Copy the default ACL of the containing directory to
770 * the access ACL of the new file and use the mode that
771 * was passed in to set up the correct initial values for
772 * the u::,g::[m::], and o:: entries. This is what makes
773 * umask() "work" with ACL's.
776 if (!(_ACL_ALLOC(cacl
)))
779 memcpy(cacl
, pdaclp
, sizeof(xfs_acl_t
));
780 xfs_acl_filter_mode(vap
->va_mode
, cacl
);
781 xfs_acl_setmode(vp
, cacl
, &basicperms
);
784 * Set the Default and Access ACL on the file. The mode is already
785 * set on the file, so we don't need to worry about that.
787 * If the new file is a directory, its default ACL is a copy of
788 * the containing directory's default ACL.
790 if (vp
->v_type
== VDIR
)
791 xfs_acl_set_attr(vp
, pdaclp
, _ACL_TYPE_DEFAULT
, &error
);
792 if (!error
&& !basicperms
)
793 xfs_acl_set_attr(vp
, cacl
, _ACL_TYPE_ACCESS
, &error
);
799 * Set up the correct mode on the file based on the supplied ACL. This
800 * makes sure that the mode on the file reflects the state of the
801 * u::,g::[m::], and o:: entries in the ACL. Since the mode is where
802 * the ACL is going to get the permissions for these entries, we must
803 * synchronize the mode whenever we set the ACL on a file.
813 xfs_acl_entry_t
*gap
= NULL
;
814 int i
, error
, nomask
= 1;
818 if (acl
->acl_cnt
== XFS_ACL_NOT_PRESENT
)
822 * Copy the u::, g::, o::, and m:: bits from the ACL into the
823 * mode. The m:: bits take precedence over the g:: bits.
825 va
.va_mask
= XFS_AT_MODE
;
826 VOP_GETATTR(vp
, &va
, 0, sys_cred
, error
);
830 va
.va_mask
= XFS_AT_MODE
;
831 va
.va_mode
&= ~(S_IRWXU
|S_IRWXG
|S_IRWXO
);
833 for (i
= 0; i
< acl
->acl_cnt
; ++i
) {
834 switch (ap
->ae_tag
) {
836 va
.va_mode
|= ap
->ae_perm
<< 6;
841 case ACL_MASK
: /* more than just standard modes */
843 va
.va_mode
|= ap
->ae_perm
<< 3;
847 va
.va_mode
|= ap
->ae_perm
;
849 default: /* more than just standard modes */
856 /* Set the group bits from ACL_GROUP_OBJ if there's no ACL_MASK */
858 va
.va_mode
|= gap
->ae_perm
<< 3;
860 VOP_SETATTR(vp
, &va
, 0, sys_cred
, error
);
865 * The permissions for the special ACL entries (u::, g::[m::], o::) are
866 * actually stored in the file mode (if there is both a group and a mask,
867 * the group is stored in the ACL entry and the mask is stored on the file).
868 * This allows the mode to remain automatically in sync with the ACL without
869 * the need for a call-back to the ACL system at every point where the mode
870 * could change. This function takes the permissions from the specified mode
871 * and places it in the supplied ACL.
873 * This implementation draws its validity from the fact that, when the ACL
874 * was assigned, the mode was copied from the ACL.
875 * If the mode did not change, therefore, the mode remains exactly what was
876 * taken from the special ACL entries at assignment.
877 * If a subsequent chmod() was done, the POSIX spec says that the change in
878 * mode must cause an update to the ACL seen at user level and used for
879 * access checks. Before and after a mode change, therefore, the file mode
880 * most accurately reflects what the special ACL entries should permit/deny.
882 * CAVEAT: If someone sets the SGI_ACL_FILE attribute directly,
883 * the existing mode bits will override whatever is in the
884 * ACL. Similarly, if there is a pre-existing ACL that was
885 * never in sync with its mode (owing to a bug in 6.5 and
886 * before), it will now magically (or mystically) be
887 * synchronized. This could cause slight astonishment, but
888 * it is better than inconsistent permissions.
890 * The supplied ACL is a template that may contain any combination
891 * of special entries. These are treated as place holders when we fill
892 * out the ACL. This routine does not add or remove special entries, it
893 * simply unites each special entry with its associated set of permissions.
902 xfs_acl_entry_t
*gap
= NULL
;
905 * Set ACL entries. POSIX1003.1eD16 requires that the MASK
906 * be set instead of the GROUP entry, if there is a MASK.
908 for (ap
= acl
->acl_entry
, i
= 0; i
< acl
->acl_cnt
; ap
++, i
++) {
909 switch (ap
->ae_tag
) {
911 ap
->ae_perm
= (mode
>> 6) & 0x7;
918 ap
->ae_perm
= (mode
>> 3) & 0x7;
921 ap
->ae_perm
= mode
& 0x7;
927 /* Set the ACL_GROUP_OBJ if there's no ACL_MASK */
929 gap
->ae_perm
= (mode
>> 3) & 0x7;
933 * When inheriting an Access ACL from a directory Default ACL,
934 * the ACL bits are set to the intersection of the ACL default
935 * permission bits and the file permission bits in mode. If there
936 * are no permission bits on the file then we must not give them
937 * the ACL. This is what what makes umask() work with ACLs.
946 xfs_acl_entry_t
*gap
= NULL
;
949 * Set ACL entries. POSIX1003.1eD16 requires that the MASK
950 * be merged with GROUP entry, if there is a MASK.
952 for (ap
= acl
->acl_entry
, i
= 0; i
< acl
->acl_cnt
; ap
++, i
++) {
953 switch (ap
->ae_tag
) {
955 ap
->ae_perm
&= (mode
>> 6) & 0x7;
962 ap
->ae_perm
&= (mode
>> 3) & 0x7;
965 ap
->ae_perm
&= mode
& 0x7;
971 /* Set the ACL_GROUP_OBJ if there's no ACL_MASK */
973 gap
->ae_perm
&= (mode
>> 3) & 0x7;