diff options
author | Chris D. Faulhaber <jedgar@FreeBSD.org> | 2001-03-22 22:31:01 +0000 |
---|---|---|
committer | Chris D. Faulhaber <jedgar@FreeBSD.org> | 2001-03-22 22:31:01 +0000 |
commit | 4bf60dfaf85eb5bcbf5c08ad39ff3e4328e55807 (patch) | |
tree | 75c5f31d69f8c45b53af5927052b9e14868dc03f /lib/libc/posix1e/acl_get.c | |
parent | 2219fbbd37b7be082230843913e3ef1f85c3f0b4 (diff) |
Notes
Diffstat (limited to 'lib/libc/posix1e/acl_get.c')
-rw-r--r-- | lib/libc/posix1e/acl_get.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c index 16ad97e59887..00a1928b109c 100644 --- a/lib/libc/posix1e/acl_get.c +++ b/lib/libc/posix1e/acl_get.c @@ -29,12 +29,17 @@ * 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_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 */ #include <sys/types.h> #include <sys/acl.h> -#include <sys/errno.h> + +#include <errno.h> #include <stdlib.h> +#include <string.h> acl_t acl_get_file(const char *path_p, acl_type_t type) @@ -95,3 +100,55 @@ acl_get_fd_np(int fd, acl_type_t type) return (aclp); } + +int +acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p) +{ + + if (!entry_d || !permset_p) { + errno = EINVAL; + return -1; + } + + *permset_p = &entry_d->ae_perm; + + return 0; +} + +void * +acl_get_qualifier(acl_entry_t entry_d) +{ + uid_t *retval; + + if (!entry_d) { + errno = EINVAL; + return NULL; + } + + switch(entry_d->ae_tag) { + case ACL_USER: + case ACL_GROUP: + retval = malloc(sizeof(uid_t)); + if (retval) { + *retval = entry_d->ae_id; + return retval; + } + } + + errno = EINVAL; + return NULL; +} + +int +acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p) +{ + + if (!entry_d || !tag_type_p) { + errno = EINVAL; + return -1; + } + + *tag_type_p = entry_d->ae_tag; + + return 0; +} |