summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2010-06-02 20:35:56 +0000
committertrasz <trasz@FreeBSD.org>2010-06-02 20:35:56 +0000
commit2d5cd857113bfc9af9145ac6ad2e8cf7923dc8a9 (patch)
treed173765dbc001ba7d8766f247203d8795a275955 /lib
parent7930bb34ef581c07835afdb3509ca1090ee9fd69 (diff)
downloadFreeBSD-src-2d5cd857113bfc9af9145ac6ad2e8cf7923dc8a9.zip
FreeBSD-src-2d5cd857113bfc9af9145ac6ad2e8cf7923dc8a9.tar.gz
MFC r208437:
Make acl_get_perm_np(3) work with NFSv4 ACLs. Reviewed by: kientzle@ Approved by: re (kib)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/posix1e/acl_get.c24
-rw-r--r--lib/libc/posix1e/acl_perm.c18
2 files changed, 18 insertions, 24 deletions
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c
index 8a77ab1..b323501 100644
--- a/lib/libc/posix1e/acl_get.c
+++ b/lib/libc/posix1e/acl_get.c
@@ -132,30 +132,6 @@ acl_get_fd_np(int fd, acl_type_t type)
return (aclp);
}
-int
-acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
-{
-
- if (permset_d == NULL) {
- errno = EINVAL;
- return (-1);
- }
-
- switch(perm) {
- case ACL_READ:
- case ACL_WRITE:
- case ACL_EXECUTE:
- if (*permset_d & perm)
- return (1);
- break;
- default:
- errno = EINVAL;
- return (-1);
- }
-
- return (0);
-}
-
/*
* acl_get_permset() (23.4.17): return via permset_p a descriptor to
* the permission set in the ACL entry entry_d.
diff --git a/lib/libc/posix1e/acl_perm.c b/lib/libc/posix1e/acl_perm.c
index b5108ca..ad2f47e 100644
--- a/lib/libc/posix1e/acl_perm.c
+++ b/lib/libc/posix1e/acl_perm.c
@@ -108,3 +108,21 @@ acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm)
return (0);
}
+
+int
+acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
+{
+
+ if (permset_d == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (_perm_is_invalid(perm))
+ return (-1);
+
+ if (*permset_d & perm)
+ return (1);
+
+ return (0);
+}
OpenPOWER on IntegriCloud