summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_to_text.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_to_text.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_to_text.c')
-rw-r--r--lib/libc/posix1e/acl_to_text.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/lib/libc/posix1e/acl_to_text.c b/lib/libc/posix1e/acl_to_text.c
index f2905c3..3485b1e 100644
--- a/lib/libc/posix1e/acl_to_text.c
+++ b/lib/libc/posix1e/acl_to_text.c
@@ -50,8 +50,11 @@ __FBSDID("$FreeBSD$");
* This function will not produce nice results if it is called with
* a non-POSIX.1e semantics ACL.
*/
-char *
-acl_to_text(acl_t acl, ssize_t *len_p)
+
+char *_nfs4_acl_to_text_np(const acl_t acl, ssize_t *len_p, int flags);
+
+static char *
+_posix1e_acl_to_text(acl_t acl, ssize_t *len_p, int flags)
{
struct acl *acl_int;
char *buf, *tmpbuf;
@@ -105,7 +108,7 @@ acl_to_text(acl_t acl, ssize_t *len_p)
goto error_label;
error = _posix1e_acl_id_to_name(ae_tag, ae_id,
- UT_NAMESIZE+1, name_buf);
+ UT_NAMESIZE+1, name_buf, flags);
if (error)
goto error_label;
@@ -165,7 +168,7 @@ acl_to_text(acl_t acl, ssize_t *len_p)
goto error_label;
error = _posix1e_acl_id_to_name(ae_tag, ae_id,
- UT_NAMESIZE+1, name_buf);
+ UT_NAMESIZE+1, name_buf, flags);
if (error)
goto error_label;
@@ -235,3 +238,25 @@ error_label:
if (buf) free(buf);
return (NULL);
}
+
+char *
+acl_to_text_np(acl_t acl, ssize_t *len_p, int flags)
+{
+
+ switch (_acl_brand(acl)) {
+ case ACL_BRAND_POSIX:
+ return (_posix1e_acl_to_text(acl, len_p, flags));
+ case ACL_BRAND_NFS4:
+ return (_nfs4_acl_to_text_np(acl, len_p, flags));
+ default:
+ errno = EINVAL;
+ return (NULL);
+ }
+}
+
+char *
+acl_to_text(acl_t acl, ssize_t *len_p)
+{
+
+ return (acl_to_text_np(acl, len_p, 0));
+}
OpenPOWER on IntegriCloud