| 2819 | } |
| 2820 | |
| 2821 | static int |
| 2822 | biba_vnode_associate_extattr(struct mount *mp, struct label *mplabel, |
| 2823 | struct vnode *vp, struct label *vplabel) |
| 2824 | { |
| 2825 | struct mac_biba mb_temp, *source, *dest; |
| 2826 | int buflen, error; |
| 2827 | |
| 2828 | source = SLOT(mplabel); |
| 2829 | dest = SLOT(vplabel); |
| 2830 | |
| 2831 | buflen = sizeof(mb_temp); |
| 2832 | bzero(&mb_temp, buflen); |
| 2833 | |
| 2834 | error = vn_extattr_get(vp, IO_NODELOCKED, MAC_BIBA_EXTATTR_NAMESPACE, |
| 2835 | MAC_BIBA_EXTATTR_NAME, &buflen, (char *) &mb_temp, curthread); |
| 2836 | if (error == ENOATTR || error == EOPNOTSUPP) { |
| 2837 | /* Fall back to the mntlabel. */ |
| 2838 | biba_copy_effective(source, dest); |
| 2839 | return (0); |
| 2840 | } else if (error) |
| 2841 | return (error); |
| 2842 | |
| 2843 | if (buflen != sizeof(mb_temp)) { |
| 2844 | printf("biba_vnode_associate_extattr: bad size %d\n", |
| 2845 | buflen); |
| 2846 | return (EPERM); |
| 2847 | } |
| 2848 | if (biba_valid(&mb_temp) != 0) { |
| 2849 | printf("biba_vnode_associate_extattr: invalid\n"); |
| 2850 | return (EPERM); |
| 2851 | } |
| 2852 | if ((mb_temp.mb_flags & MAC_BIBA_FLAGS_BOTH) != |
| 2853 | MAC_BIBA_FLAG_EFFECTIVE) { |
| 2854 | printf("biba_vnode_associate_extattr: not effective\n"); |
| 2855 | return (EPERM); |
| 2856 | } |
| 2857 | |
| 2858 | biba_copy_effective(&mb_temp, dest); |
| 2859 | return (0); |
| 2860 | } |
| 2861 | |
| 2862 | static void |
| 2863 | biba_vnode_associate_singlelabel(struct mount *mp, struct label *mplabel, |
nothing calls this directly
no test coverage detected