| 656 | } |
| 657 | |
| 658 | static int |
| 659 | lomac_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 | |
| 698 | static int |
| 699 | lomac_externalize_label(struct label *label, char *element_name, |
no test coverage detected