summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_support.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2000-01-26 04:19:38 +0000
committerrwatson <rwatson@FreeBSD.org>2000-01-26 04:19:38 +0000
commitbca585a108d2bd5fc957868c934f851e28cc1fdc (patch)
tree9bf727d760779145abf4d333b026744f16082345 /lib/libc/posix1e/acl_support.c
parent994e477fcd5e774b309e83aa9a4b9dc634ce39e2 (diff)
downloadFreeBSD-src-bca585a108d2bd5fc957868c934f851e28cc1fdc.zip
FreeBSD-src-bca585a108d2bd5fc957868c934f851e28cc1fdc.tar.gz
Minor fixes to library interface to improve POSIX.1e compliance. This
adds _np to a couple of function prototypes that provided more broad/useful interfaces than POSIX.1e interfaces included. Also, move from using a heuristic to identify POSIX.1e-semantic ACLs to using different ACL types for non-POSIX.1e ACLs. This should clean up the existing fuzzy logic that determined when acl_sort() should be applied before kernel submission.
Diffstat (limited to 'lib/libc/posix1e/acl_support.c')
-rw-r--r--lib/libc/posix1e/acl_support.c49
1 files changed, 5 insertions, 44 deletions
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c
index 9f9ae26..a136407 100644
--- a/lib/libc/posix1e/acl_support.c
+++ b/lib/libc/posix1e/acl_support.c
@@ -86,7 +86,6 @@ acl_entry_compare(struct acl_entry *a, struct acl_entry *b)
return (0);
}
-
/*
* acl_sort -- sort ACL entries.
* Give the opportunity to fail, althouh we don't currently have a way
@@ -102,49 +101,18 @@ acl_sort(acl_t acl)
return (0);
}
-
/*
- * acl_posix1e -- use a heuristic to determine if this is a POSIX.1e
- * semantics ACL. This will be used by other routines to determine if
- * they should call acl_sort() on the ACL before submitting to the kernel,
- * as the POSIX.1e ACL semantics code requires sorted ACL submission.
- * Also, acl_valid will use this to determine if it understands the
- * semantics enough to check that the ACL is correct.
+ * acl_posix1e -- in what situations should we acl_sort before submission?
+ * We apply posix1e ACL semantics for any ACL of type ACL_TYPE_ACCESS or
+ * ACL_TYPE_DEFAULT
*/
int
-acl_posix1e(acl_t acl)
+acl_posix1e(acl_t acl, acl_type_t type)
{
- int i;
-
- /* assume it's POSIX.1e, and return 0 if otherwise */
- for (i = 0; i < acl->acl_cnt; i++) {
- /* is the tag type POSIX.1e? */
- switch(acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- case ACL_USER:
- case ACL_GROUP_OBJ:
- case ACL_GROUP:
- case ACL_MASK:
- case ACL_OTHER:
- break;
-
- default:
- return (0);
- }
-
- /* are the permissions POSIX.1e, or FreeBSD extensions? */
- if (((acl->acl_entry[i].ae_perm | ACL_POSIX1E_BITS) !=
- ACL_POSIX1E_BITS) &&
- ((acl->acl_entry[i].ae_perm | ACL_PERM_BITS) !=
- ACL_PERM_BITS))
- return (0);
- }
-
- return(1);
+ return ((type == ACL_TYPE_ACCESS) || (type == ACL_TYPE_DEFAULT));
}
-
/*
* acl_check -- given an ACL, check its validity. This is mirrored from
* code in sys/kern/kern_acl.c, and if changes are made in one, they should
@@ -385,7 +353,6 @@ acl_perm_to_string(acl_perm_t perm, ssize_t buf_len, char *buf)
return (0);
}
-
/*
* given a string, return a permission describing it
*/
@@ -419,8 +386,6 @@ acl_string_to_perm(char *string, acl_perm_t *perm)
return (0);
}
-
-
/*
* Add an ACL entry without doing much checking, et al
*/
@@ -442,7 +407,3 @@ acl_add_entry(acl_t acl, acl_tag_t tag, uid_t id, acl_perm_t perm)
return (0);
}
-
-
-
-
OpenPOWER on IntegriCloud