summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_get.c
diff options
context:
space:
mode:
authorjedgar <jedgar@FreeBSD.org>2001-04-13 19:37:04 +0000
committerjedgar <jedgar@FreeBSD.org>2001-04-13 19:37:04 +0000
commit0575e04a306c02e21d471bb05bc5145975a72e11 (patch)
tree86a6127b81ddab0a7d02f74ab0e1c5477b391c05 /lib/libc/posix1e/acl_get.c
parent9fca9e8cc8da7dc976fb0c914b2e40397d3a533a (diff)
downloadFreeBSD-src-0575e04a306c02e21d471bb05bc5145975a72e11.zip
FreeBSD-src-0575e04a306c02e21d471bb05bc5145975a72e11.tar.gz
Add acl_get_perm_np(3), a non-portable function to check if a
permission is in a permission set, required for third-party applications such as Samba. Reviewed by: rwatson Obtained from: TrustedBSD Project
Diffstat (limited to 'lib/libc/posix1e/acl_get.c')
-rw-r--r--lib/libc/posix1e/acl_get.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c
index 2d5ebff..3388041 100644
--- a/lib/libc/posix1e/acl_get.c
+++ b/lib/libc/posix1e/acl_get.c
@@ -29,6 +29,8 @@
* acl_get_file - syscall wrapper for retrieving ACL by filename
* acl_get_fd - syscall wrapper for retrieving access ACL by fd
* acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX)
+ * acl_get_perm_np() checks if a permission is in the specified
+ * permset (non-POSIX)
* acl_get_permset() returns the permission set in the ACL entry
* acl_get_qualifier() retrieves the qualifier of the tag from the ACL entry
* acl_get_tag_type() returns the tag type for the ACL entry entry_d
@@ -104,6 +106,25 @@ acl_get_fd_np(int fd, acl_type_t type)
}
int
+acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
+{
+
+ 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;
+}
+
+int
acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p)
{
OpenPOWER on IntegriCloud