summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_get.c
diff options
context:
space:
mode:
authorjedgar <jedgar@FreeBSD.org>2001-03-22 22:31:01 +0000
committerjedgar <jedgar@FreeBSD.org>2001-03-22 22:31:01 +0000
commita2c2ce60b3075656d05b60cdc57e87a284637374 (patch)
tree4ef0b68e84c3b26506377d62e3387915a6738e83 /lib/libc/posix1e/acl_get.c
parenteee9cab668b487432cc086947e228ad81ea24422 (diff)
downloadFreeBSD-src-a2c2ce60b3075656d05b60cdc57e87a284637374.zip
FreeBSD-src-a2c2ce60b3075656d05b60cdc57e87a284637374.tar.gz
Add the following ACL editing functions:
acl_add_perm, acl_clear_perms, acl_copy_entry, acl_create_entry, acl_delete_perm, acl_get_permset, acl_get_qualifier, acl_get_tag_type, acl_set_permset, acl_set_qualifier, acl_set_tag_type This brings us within 4 functions of a full ACL editing library. Reviewed by: rwatson
Diffstat (limited to 'lib/libc/posix1e/acl_get.c')
-rw-r--r--lib/libc/posix1e/acl_get.c59
1 files changed, 58 insertions, 1 deletions
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c
index 16ad97e..00a1928 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;
+}
OpenPOWER on IntegriCloud