summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_copy.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_copy.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_copy.c')
-rw-r--r--lib/libc/posix1e/acl_copy.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/libc/posix1e/acl_copy.c b/lib/libc/posix1e/acl_copy.c
index eefa1c8..fc4c25d 100644
--- a/lib/libc/posix1e/acl_copy.c
+++ b/lib/libc/posix1e/acl_copy.c
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <string.h>
+#include "acl_support.h"
+
/*
* acl_copy_entry() (23.4.4): copy the contents of ACL entry src_d to
* ACL entry dest_d
@@ -48,9 +50,21 @@ acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d)
return (-1);
}
- dest_d->ae_tag = src_d->ae_tag;
- dest_d->ae_id = src_d->ae_id;
+ /*
+ * Can we brand the new entry the same as the source entry?
+ */
+ if (!_entry_brand_may_be(dest_d, _entry_brand(src_d))) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ _entry_brand_as(dest_d, _entry_brand(src_d));
+
+ dest_d->ae_tag = src_d->ae_tag;
+ dest_d->ae_id = src_d->ae_id;
dest_d->ae_perm = src_d->ae_perm;
+ dest_d->ae_entry_type = src_d->ae_entry_type;
+ dest_d->ae_flags = src_d->ae_flags;
return (0);
}
OpenPOWER on IntegriCloud