diff options
Diffstat (limited to 'src/shared/acl-util.c')
-rw-r--r-- | src/shared/acl-util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c index 48bb12f46b..fb04e49dc4 100644 --- a/src/shared/acl-util.c +++ b/src/shared/acl-util.c @@ -69,6 +69,34 @@ int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) { return 0; } +int calc_acl_mask_if_needed(acl_t *acl_p) { + acl_entry_t i; + int found; + + assert(acl_p); + + for (found = acl_get_entry(*acl_p, ACL_FIRST_ENTRY, &i); + found > 0; + found = acl_get_entry(*acl_p, ACL_NEXT_ENTRY, &i)) { + + acl_tag_t tag; + + if (acl_get_tag_type(i, &tag) < 0) + return -errno; + + if (tag == ACL_MASK) + return 0; + } + + if (found < 0) + return -errno; + + if (acl_calc_mask(acl_p) < 0) + return -errno; + + return 0; +} + int search_acl_groups(char*** dst, const char* path, bool* belong) { acl_t acl; |