Lines Matching refs:mb

157 biba_free(struct mac_biba *mb)  in biba_free()  argument
160 if (mb != NULL) in biba_free()
161 uma_zfree(zone_biba, mb); in biba_free()
167 biba_atmostflags(struct mac_biba *mb, int flags) in biba_atmostflags() argument
170 if ((mb->mb_flags & flags) != mb->mb_flags) in biba_atmostflags()
228 biba_subject_dominate_high(struct mac_biba *mb) in biba_subject_dominate_high() argument
232 KASSERT((mb->mb_flags & MAC_BIBA_FLAG_EFFECTIVE) != 0, in biba_subject_dominate_high()
234 element = &mb->mb_effective; in biba_subject_dominate_high()
302 biba_contains_equal(struct mac_biba *mb) in biba_contains_equal() argument
305 if (mb->mb_flags & MAC_BIBA_FLAG_EFFECTIVE) { in biba_contains_equal()
306 if (mb->mb_effective.mbe_type == MAC_BIBA_TYPE_EQUAL) in biba_contains_equal()
310 if (mb->mb_flags & MAC_BIBA_FLAG_RANGE) { in biba_contains_equal()
311 if (mb->mb_rangelow.mbe_type == MAC_BIBA_TYPE_EQUAL) in biba_contains_equal()
313 if (mb->mb_rangehigh.mbe_type == MAC_BIBA_TYPE_EQUAL) in biba_contains_equal()
321 biba_subject_privileged(struct mac_biba *mb) in biba_subject_privileged() argument
324 KASSERT((mb->mb_flags & MAC_BIBA_FLAGS_BOTH) == MAC_BIBA_FLAGS_BOTH, in biba_subject_privileged()
328 if (mb->mb_effective.mbe_type == MAC_BIBA_TYPE_EQUAL) in biba_subject_privileged()
332 if (mb->mb_rangelow.mbe_type == MAC_BIBA_TYPE_EQUAL || in biba_subject_privileged()
333 mb->mb_rangehigh.mbe_type == MAC_BIBA_TYPE_EQUAL) in biba_subject_privileged()
337 if (mb->mb_rangelow.mbe_type == MAC_BIBA_TYPE_LOW && in biba_subject_privileged()
338 mb->mb_rangehigh.mbe_type == MAC_BIBA_TYPE_HIGH) in biba_subject_privileged()
346 biba_high_effective(struct mac_biba *mb) in biba_high_effective() argument
349 KASSERT((mb->mb_flags & MAC_BIBA_FLAG_EFFECTIVE) != 0, in biba_high_effective()
352 return (mb->mb_effective.mbe_type == MAC_BIBA_TYPE_HIGH); in biba_high_effective()
356 biba_valid(struct mac_biba *mb) in biba_valid() argument
359 if (mb->mb_flags & MAC_BIBA_FLAG_EFFECTIVE) { in biba_valid()
360 switch (mb->mb_effective.mbe_type) { in biba_valid()
367 if (mb->mb_effective.mbe_grade != 0 || in biba_valid()
369 mb->mb_effective.mbe_compartments)) in biba_valid()
377 if (mb->mb_effective.mbe_type != MAC_BIBA_TYPE_UNDEF) in biba_valid()
381 if (mb->mb_flags & MAC_BIBA_FLAG_RANGE) { in biba_valid()
382 switch (mb->mb_rangelow.mbe_type) { in biba_valid()
389 if (mb->mb_rangelow.mbe_grade != 0 || in biba_valid()
391 mb->mb_rangelow.mbe_compartments)) in biba_valid()
399 switch (mb->mb_rangehigh.mbe_type) { in biba_valid()
406 if (mb->mb_rangehigh.mbe_grade != 0 || in biba_valid()
408 mb->mb_rangehigh.mbe_compartments)) in biba_valid()
415 if (!biba_dominate_element(&mb->mb_rangehigh, in biba_valid()
416 &mb->mb_rangelow)) in biba_valid()
419 if (mb->mb_rangelow.mbe_type != MAC_BIBA_TYPE_UNDEF || in biba_valid()
420 mb->mb_rangehigh.mbe_type != MAC_BIBA_TYPE_UNDEF) in biba_valid()
428 biba_set_range(struct mac_biba *mb, u_short typelow, u_short gradelow, in biba_set_range() argument
433 mb->mb_rangelow.mbe_type = typelow; in biba_set_range()
434 mb->mb_rangelow.mbe_grade = gradelow; in biba_set_range()
436 memcpy(mb->mb_rangelow.mbe_compartments, compartmentslow, in biba_set_range()
437 sizeof(mb->mb_rangelow.mbe_compartments)); in biba_set_range()
438 mb->mb_rangehigh.mbe_type = typehigh; in biba_set_range()
439 mb->mb_rangehigh.mbe_grade = gradehigh; in biba_set_range()
441 memcpy(mb->mb_rangehigh.mbe_compartments, compartmentshigh, in biba_set_range()
442 sizeof(mb->mb_rangehigh.mbe_compartments)); in biba_set_range()
443 mb->mb_flags |= MAC_BIBA_FLAG_RANGE; in biba_set_range()
447 biba_set_effective(struct mac_biba *mb, u_short type, u_short grade, in biba_set_effective() argument
451 mb->mb_effective.mbe_type = type; in biba_set_effective()
452 mb->mb_effective.mbe_grade = grade; in biba_set_effective()
454 memcpy(mb->mb_effective.mbe_compartments, compartments, in biba_set_effective()
455 sizeof(mb->mb_effective.mbe_compartments)); in biba_set_effective()
456 mb->mb_flags |= MAC_BIBA_FLAG_EFFECTIVE; in biba_set_effective()
587 biba_to_string(struct sbuf *sb, struct mac_biba *mb) in biba_to_string() argument
590 if (mb->mb_flags & MAC_BIBA_FLAG_EFFECTIVE) { in biba_to_string()
591 if (biba_element_to_string(sb, &mb->mb_effective) == -1) in biba_to_string()
595 if (mb->mb_flags & MAC_BIBA_FLAG_RANGE) { in biba_to_string()
599 if (biba_element_to_string(sb, &mb->mb_rangelow) == -1) in biba_to_string()
605 if (biba_element_to_string(sb, &mb->mb_rangehigh) == -1) in biba_to_string()
619 struct mac_biba *mb; in biba_externalize_label() local
626 mb = SLOT(label); in biba_externalize_label()
627 return (biba_to_string(sb, mb)); in biba_externalize_label()
687 biba_parse(struct mac_biba *mb, char *string) in biba_parse() argument
714 bzero(mb, sizeof(*mb)); in biba_parse()
716 error = biba_parse_element(&mb->mb_effective, effective); in biba_parse()
719 mb->mb_flags |= MAC_BIBA_FLAG_EFFECTIVE; in biba_parse()
723 error = biba_parse_element(&mb->mb_rangelow, rangelow); in biba_parse()
726 error = biba_parse_element(&mb->mb_rangehigh, rangehigh); in biba_parse()
729 mb->mb_flags |= MAC_BIBA_FLAG_RANGE; in biba_parse()
732 error = biba_valid(mb); in biba_parse()
743 struct mac_biba *mb, mb_temp; in biba_internalize_label() local
755 mb = SLOT(label); in biba_internalize_label()
756 *mb = mb_temp; in biba_internalize_label()
942 struct mac_biba *mb; in biba_devfs_create_device() local
946 mb = SLOT(delabel); in biba_devfs_create_device()
960 biba_set_effective(mb, biba_type, 0, NULL); in biba_devfs_create_device()
967 struct mac_biba *mb; in biba_devfs_create_directory() local
969 mb = SLOT(delabel); in biba_devfs_create_directory()
971 biba_set_effective(mb, MAC_BIBA_TYPE_HIGH, 0, NULL); in biba_devfs_create_directory()