Lines Matching +full:x +full:- +full:mask +full:-
50 static int l9p_check_aces(int32_t mask, struct l9p_acl *acl, struct stat *st,
61 * Is the given group ID tid (test-id) any of the gid's in agids?
82 * or have cleared out all our attempt-something bits. Once
91 * -1 (negative = no = denied), or 0 (no strong answer).
94 * mask of 0, we return 0 (no answer).
97 l9p_check_aces(int32_t mask, struct l9p_acl *acl, struct stat *st, in l9p_check_aces() argument
109 if (mask == 0) in l9p_check_aces()
112 for (i = 0; mask != 0 && i < acl->acl_nace; i++) { in l9p_check_aces()
113 ace = &acl->acl_aces[i]; in l9p_check_aces()
114 switch (ace->ace_type) { in l9p_check_aces()
119 /* audit, alarm - ignore */ in l9p_check_aces()
125 if (ace->ace_flags & L9P_ACEF_OWNER) { in l9p_check_aces()
129 match = st->st_uid == uid; in l9p_check_aces()
130 } else if (ace->ace_flags & L9P_ACEF_GROUP) { in l9p_check_aces()
134 match = l9p_ingroup(st->st_gid, gid, gids, ngids); in l9p_check_aces()
135 } else if (ace->ace_flags & L9P_ACEF_EVERYONE) { in l9p_check_aces()
141 if (ace->ace_idsize != sizeof(tid)) in l9p_check_aces()
146 memcpy(&tid, &ace->ace_idbytes, sizeof(tid)); in l9p_check_aces()
147 if (ace->ace_flags & L9P_ACEF_IDENTIFIER_GROUP) { in l9p_check_aces()
166 allowdeny = ace->ace_type == L9P_ACET_ACCESS_DENIED ? in l9p_check_aces()
169 if (match && (ace->ace_mask & (uint32_t)mask) != 0) { in l9p_check_aces()
173 "ACE: %s %s %d: mask 0x%x ace_mask 0x%x", in l9p_check_aces()
175 (u_int)mask, (u_int)ace->ace_mask); in l9p_check_aces()
178 "ACE: %s %s: mask 0x%x ace_mask 0x%x", in l9p_check_aces()
180 (u_int)mask, (u_int)ace->ace_mask); in l9p_check_aces()
182 if (ace->ace_type == L9P_ACET_ACCESS_DENIED) in l9p_check_aces()
183 return (-1); in l9p_check_aces()
184 mask &= ~ace->ace_mask; in l9p_check_aces()
186 L9P_LOG(L9P_DEBUG, "clear 0x%x: now mask=0x%x", in l9p_check_aces()
187 (u_int)ace->ace_mask, (u_int)mask); in l9p_check_aces()
194 "match %d mask 0x%x ace_mask 0x%x", in l9p_check_aces()
196 (int)match, (u_int)mask, in l9p_check_aces()
197 (u_int)ace->ace_mask); in l9p_check_aces()
201 "match %d mask 0x%x ace_mask 0x%x", in l9p_check_aces()
203 (int)match, (u_int)mask, in l9p_check_aces()
204 (u_int)ace->ace_mask); in l9p_check_aces()
211 L9P_LOG(L9P_DEBUG, "ACE: end of ACEs, mask now 0x%x: %s", in l9p_check_aces()
212 mask, mask ? "no-definitive-answer" : "ALLOW"); in l9p_check_aces()
214 return (mask == 0 ? 1 : 0); in l9p_check_aces()
224 * set the mask to test the directory permissions (not ADD_FILE but
254 parent = args->aca_parent; in l9p_acl_check_access()
255 pstat = args->aca_pstat; in l9p_acl_check_access()
256 child = args->aca_child; in l9p_acl_check_access()
257 cstat = args->aca_cstat; in l9p_acl_check_access()
258 uid = args->aca_uid; in l9p_acl_check_access()
259 gid = args->aca_gid; in l9p_acl_check_access()
260 gids = args->aca_groups; in l9p_acl_check_access()
261 ngids = args->aca_ngroups; in l9p_acl_check_access()
265 "l9p_acl_check_access: opmask=0x%x uid=%ld gid=%ld ngids=%zd", in l9p_acl_check_access()
272 if (uid == 0 && args->aca_superuser) in l9p_acl_check_access()
276 * If told to ignore ACLs and use only stat-based permissions, in l9p_acl_check_access()
277 * discard any non-NULL ACL pointers. in l9p_acl_check_access()
281 if ((args->aca_aclmode & L9P_ACM_NFS_ACL) == 0) in l9p_acl_check_access()
284 assert(parent == NULL || parent->acl_acetype == L9P_ACLTYPE_NFSv4); in l9p_acl_check_access()
286 assert(child == NULL || child->acl_acetype == L9P_ACLTYPE_NFSv4); in l9p_acl_check_access()
304 * Remove child-only bits from parent op and in l9p_acl_check_access()
305 * parent-only bits from child op. in l9p_acl_check_access()
307 * L9P_ACE_DELETE is child-only. in l9p_acl_check_access()
309 * L9P_ACE_DELETE_CHILD is parent-only, and three data in l9p_acl_check_access()
320 * Remove child-only bits from parent op. We need in l9p_acl_check_access()
346 * not 100% clear how to handle the two-answer in l9p_acl_check_access()
356 /* non-definitive answer from one! move on */ in l9p_acl_check_access()
372 * If so, find write-and-execute permission on parent. in l9p_acl_check_access()
373 * Note that WRITE overlaps with ADD_FILE -- that's ZFS's in l9p_acl_check_access()
374 * way of saying "allow write to dir" -- but EXECUTE is in l9p_acl_check_access()
383 if ((args->aca_aclmode & L9P_ACM_ZFS_ACL) && in l9p_acl_check_access()
403 if (args->aca_aclmode & L9P_ACM_STAT_MODE) { in l9p_acl_check_access()
410 if (uid == st->st_uid) in l9p_acl_check_access()
411 bits = (st->st_mode >> 6) & 7; in l9p_acl_check_access()
412 else if (l9p_ingroup(st->st_gid, gid, gids, ngids)) in l9p_acl_check_access()
413 bits = (st->st_mode >> 3) & 7; in l9p_acl_check_access()
415 bits = st->st_mode & 7; in l9p_acl_check_access()
428 * Collapse fancy ACL operation mask down to simple Unix bits.
470 ret->acl_acetype = acetype; in l9p_new_acl()
471 ret->acl_nace = 0; in l9p_new_acl()
472 ret->acl_aceasize = aceasize; in l9p_new_acl()
480 * Currently won't shrink, only grow, so it's a fast no-op until
490 if (acl->acl_aceasize < aceasize) { in l9p_growacl()
502 * Annoyingly, there's no POSIX-standard way to count the number
544 error = (*convert)(entry, &acl->acl_aces[n]); in l9p_sysacl_to_acl()
549 acl->acl_nace = n; in l9p_sysacl_to_acl()
571 uint32_t flags, mask; in l9p_frombsdnfs4() local
589 /* move user/group/everyone + id-is-group-id into flags */ in l9p_frombsdnfs4()
618 ace->ace_type = L9P_ACET_ACCESS_ALLOWED; in l9p_frombsdnfs4()
622 ace->ace_type = L9P_ACET_ACCESS_DENIED; in l9p_frombsdnfs4()
626 ace->ace_type = L9P_ACET_SYSTEM_AUDIT; in l9p_frombsdnfs4()
630 ace->ace_type = L9P_ACET_SYSTEM_ALARM; in l9p_frombsdnfs4()
637 /* transform remaining BSD flags to internal NFS-y form */ in l9p_frombsdnfs4()
651 ace->ace_flags = flags; in l9p_frombsdnfs4()
661 mask = 0; in l9p_frombsdnfs4()
664 mask |= L9P_ACE_READ_DATA; in l9p_frombsdnfs4()
666 mask |= L9P_ACE_WRITE_DATA; in l9p_frombsdnfs4()
668 mask |= L9P_ACE_APPEND_DATA; in l9p_frombsdnfs4()
670 mask |= L9P_ACE_READ_NAMED_ATTRS; in l9p_frombsdnfs4()
672 mask |= L9P_ACE_WRITE_NAMED_ATTRS; in l9p_frombsdnfs4()
674 mask |= L9P_ACE_EXECUTE; in l9p_frombsdnfs4()
676 mask |= L9P_ACE_DELETE_CHILD; in l9p_frombsdnfs4()
678 mask |= L9P_ACE_READ_ATTRIBUTES; in l9p_frombsdnfs4()
680 mask |= L9P_ACE_WRITE_ATTRIBUTES; in l9p_frombsdnfs4()
685 mask |= L9P_ACE_DELETE; in l9p_frombsdnfs4()
687 mask |= L9P_ACE_READ_ACL; in l9p_frombsdnfs4()
689 mask |= L9P_ACE_WRITE_ACL; in l9p_frombsdnfs4()
691 mask |= L9P_ACE_WRITE_OWNER; in l9p_frombsdnfs4()
693 mask |= L9P_ACE_SYNCHRONIZE; in l9p_frombsdnfs4()
694 ace->ace_mask = mask; in l9p_frombsdnfs4()
696 /* fill in variable-size user or group ID bytes */ in l9p_frombsdnfs4()
698 ace->ace_idsize = 0; in l9p_frombsdnfs4()
700 ace->ace_idsize = sizeof(uid); in l9p_frombsdnfs4()
701 memcpy(&ace->ace_idbytes[0], aid, sizeof(uid)); in l9p_frombsdnfs4()