MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lomac_to_string

Function lomac_to_string

freebsd/security/mac_lomac/mac_lomac.c:658–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658static int
659lomac_to_string(struct sbuf *sb, struct mac_lomac *ml)
660{
661
662 if (ml->ml_flags & MAC_LOMAC_FLAG_SINGLE) {
663 if (lomac_element_to_string(sb, &ml->ml_single) == -1)
664 return (EINVAL);
665 }
666
667 if (ml->ml_flags & MAC_LOMAC_FLAG_AUX) {
668 if (sbuf_putc(sb, '[') == -1)
669 return (EINVAL);
670
671 if (lomac_element_to_string(sb, &ml->ml_auxsingle) == -1)
672 return (EINVAL);
673
674 if (sbuf_putc(sb, ']') == -1)
675 return (EINVAL);
676 }
677
678 if (ml->ml_flags & MAC_LOMAC_FLAG_RANGE) {
679 if (sbuf_putc(sb, '(') == -1)
680 return (EINVAL);
681
682 if (lomac_element_to_string(sb, &ml->ml_rangelow) == -1)
683 return (EINVAL);
684
685 if (sbuf_putc(sb, '-') == -1)
686 return (EINVAL);
687
688 if (lomac_element_to_string(sb, &ml->ml_rangehigh) == -1)
689 return (EINVAL);
690
691 if (sbuf_putc(sb, ')') == -1)
692 return (EINVAL);
693 }
694
695 return (0);
696}
697
698static int
699lomac_externalize_label(struct label *label, char *element_name,

Callers 2

maybe_demoteFunction · 0.85
lomac_externalize_labelFunction · 0.85

Calls 2

lomac_element_to_stringFunction · 0.85
sbuf_putcFunction · 0.85

Tested by

no test coverage detected