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

Function biba_vnode_associate_extattr

freebsd/security/mac_biba/mac_biba.c:2821–2860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2819}
2820
2821static int
2822biba_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
2862static void
2863biba_vnode_associate_singlelabel(struct mount *mp, struct label *mplabel,

Callers

nothing calls this directly

Calls 5

bzeroFunction · 0.85
vn_extattr_getFunction · 0.85
biba_copy_effectiveFunction · 0.85
biba_validFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected