예제 #1
0
/*
 * For POSIX.1e-semantic ACLs, do a presort so the kernel doesn't have to
 * (the POSIX.1e semantic code will reject unsorted ACL submission).  If it's
 * not a semantic that the library knows about, just submit it flat and
 * assume the caller knows what they're up to.
 */
int
acl_set_file(const char *path_p, acl_type_t type, acl_t acl)
{
    int	error;

    if (acl_posix1e(acl, type)) {
        error = acl_sort(acl);
        if (error) {
            errno = error;
            return (-1);
        }
    }

    return (__acl_set_file(path_p, type, acl));
}
예제 #2
0
/*
 * For POSIX.1e-semantic ACLs, do a presort so the kernel doesn't have to
 * (the POSIX.1e semantic code will reject unsorted ACL submission).  If it's
 * not a semantic that the library knows about, just submit it flat and
 * assume the caller knows what they're up to.
 */
int
acl_set_file(const char *path_p, acl_type_t type, acl_t acl)
{

	if (acl == NULL || path_p == NULL) {
		errno = EINVAL;
		return (-1);
	}
	type = _acl_type_unold(type);
	if (_acl_type_not_valid_for_acl(acl, type)) {
		errno = EINVAL;
		return (-1);
	}
	if (_posix1e_acl(acl, type))
		_posix1e_acl_sort(acl);

	acl->ats_cur_entry = 0;

	return (__acl_set_file(path_p, type, &acl->ats_acl));
}