summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_calc_mask.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2009-06-25 12:46:59 +0000
committertrasz <trasz@FreeBSD.org>2009-06-25 12:46:59 +0000
commitff2751123334f5d80faa47567304d59aed236eba (patch)
tree2ef84b1a3d387c8edf2b81194552ad8337bd003b /lib/libc/posix1e/acl_calc_mask.c
parent9a27798fa1cde67ed249d166ee358fee1a684179 (diff)
downloadFreeBSD-src-ff2751123334f5d80faa47567304d59aed236eba.zip
FreeBSD-src-ff2751123334f5d80faa47567304d59aed236eba.tar.gz
Add NFSv4 ACL support to libc.
This adds the following functions to the acl(3) API: acl_add_flag_np, acl_clear_flags_np, acl_create_entry_np, acl_delete_entry_np, acl_delete_flag_np, acl_get_extended_np, acl_get_flag_np, acl_get_flagset_np, acl_set_extended_np, acl_set_flagset_np, acl_to_text_np, acl_is_trivial_np, acl_strip_np, acl_get_brand_np. Most of them are similar to what Darwin does. There are no backward-incompatible changes. Approved by: rwatson@
Diffstat (limited to 'lib/libc/posix1e/acl_calc_mask.c')
-rw-r--r--lib/libc/posix1e/acl_calc_mask.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/posix1e/acl_calc_mask.c b/lib/libc/posix1e/acl_calc_mask.c
index 085ac9c..95fd260 100644
--- a/lib/libc/posix1e/acl_calc_mask.c
+++ b/lib/libc/posix1e/acl_calc_mask.c
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <stdio.h>
+#include "acl_support.h"
+
/*
* acl_calc_mask() (23.4.2): calculate and set the permissions
* associated with the ACL_MASK ACL entry. If the ACL already
@@ -48,6 +50,12 @@ acl_calc_mask(acl_t *acl_p)
acl_t acl_new;
int i, mask_mode, mask_num;
+ if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) {
+ errno = EINVAL;
+ return (-1);
+ }
+ _acl_brand_as(*acl_p, ACL_BRAND_POSIX);
+
/*
* (23.4.2.4) requires acl_p to point to a pointer to a valid ACL.
* Since one of the primary reasons to use this function would be
OpenPOWER on IntegriCloud