When implementing getsockopt() for SO_LABEL and SO_PEERLABEL, make

sure to sooptcopyin() the (struct mac) so that the MAC Framework
knows which label types are being requested.  This fixes process
queries of socket labels.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
This commit is contained in:
Robert Watson 2003-11-16 03:53:36 +00:00
parent 5d9d409ca9
commit 12cbb9dc56

View File

@ -1599,6 +1599,10 @@ sogetopt(so, sopt)
break;
case SO_LABEL:
#ifdef MAC
error = sooptcopyin(sopt, &extmac, sizeof(extmac),
sizeof(extmac));
if (error)
return (error);
error = mac_getsockopt_label_get(
sopt->sopt_td->td_ucred, so, &extmac);
if (error)
@ -1610,6 +1614,10 @@ sogetopt(so, sopt)
break;
case SO_PEERLABEL:
#ifdef MAC
error = sooptcopyin(sopt, &extmac, sizeof(extmac),
sizeof(extmac));
if (error)
return (error);
error = mac_getsockopt_peerlabel_get(
sopt->sopt_td->td_ucred, so, &extmac);
if (error)