summaryrefslogtreecommitdiffstats
path: root/bin/setfacl/mask.c
diff options
context:
space:
mode:
authorjedgar <jedgar@FreeBSD.org>2001-04-24 22:45:41 +0000
committerjedgar <jedgar@FreeBSD.org>2001-04-24 22:45:41 +0000
commit2da23531d99e45f34811fd6982a681112de0e182 (patch)
tree0b8830fcccafadf6607f3658e96733124ef8617d /bin/setfacl/mask.c
parentecbf3eacd9a17a3a9b238e2fa65b2d33d85e8d1f (diff)
downloadFreeBSD-src-2da23531d99e45f34811fd6982a681112de0e182.zip
FreeBSD-src-2da23531d99e45f34811fd6982a681112de0e182.tar.gz
o Separate acl_t into internal and external representations as
required by POSIX.1e. This maintains the current 'struct acl' in the kernel while providing the generic external acl_t interface required to complete the ACL editing library. o Add the acl_get_entry() function. o Convert the existing ACL utilities, getfacl and setfacl, to fully make use of the ACL editing library. Obtained from: TrustedBSD Project
Diffstat (limited to 'bin/setfacl/mask.c')
-rw-r--r--bin/setfacl/mask.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/bin/setfacl/mask.c b/bin/setfacl/mask.c
index 5992e94..595ab44 100644
--- a/bin/setfacl/mask.c
+++ b/bin/setfacl/mask.c
@@ -40,10 +40,14 @@
/* set the appropriate mask the given ACL's */
int
-set_acl_mask(acl_t prev_acl)
+set_acl_mask(acl_t *prev_acl)
{
+ acl_entry_t entry;
acl_t acl;
- int i;
+ acl_tag_t tag;
+ int entry_id;
+
+ entry = NULL;
/*
* ... if a mask entry is specified, then the permissions of the mask
@@ -53,7 +57,7 @@ set_acl_mask(acl_t prev_acl)
if (have_mask)
return 0;
- acl = acl_dup(prev_acl);
+ acl = acl_dup(*prev_acl);
if (!acl)
err(EX_OSERR, "acl_dup() failed");
@@ -76,11 +80,19 @@ set_acl_mask(acl_t prev_acl)
* specified, then the permissions of the resulting ACL
* mask entry shall remain unchanged ...
*/
- for (i = 0; i < acl->acl_cnt; i++)
- if (acl->acl_entry[i].ae_tag == ACL_MASK) {
+
+ entry_id = ACL_FIRST_ENTRY;
+
+ while (acl_get_entry(acl, entry_id, &entry) == 1) {
+ entry_id = ACL_NEXT_ENTRY;
+ if (acl_get_tag_type(entry, &tag) == -1)
+ err(1, "acl_get_tag_type() failed");
+
+ if (tag == ACL_MASK) {
acl_free(acl);
return 0;
}
+ }
/*
* If no mask entry is specified, the -n option is specified,
@@ -93,7 +105,7 @@ set_acl_mask(acl_t prev_acl)
return 0;
}
- *prev_acl = *acl;
+ prev_acl = &acl;
acl_free(acl);
return 0;
OpenPOWER on IntegriCloud