o cap_set_flag() was not correctly clearing capabilities when value

was CAP_CLEAR.

Obtained from:	TrustedBSD Project
This commit is contained in:
Robert Watson 2000-09-19 00:10:39 +00:00
parent 081cb6b302
commit 9f3aa35641
2 changed files with 10 additions and 4 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD$
*/ */
/* /*
* TrustedBSD Project - support for POSIX.1e process capabilities * TrustedBSD Project - support for POSIX.1e process capabilities
@ -55,7 +55,10 @@ cap_set_flag(cap_t cap_p, cap_flag_t flag, int ncap, cap_value_t caps[],
} }
for (i = 0; i < ncap; i++) for (i = 0; i < ncap; i++)
SET_CAPABILITY(mask, caps[i]); if (value == CAP_SET)
SET_CAPABILITY(mask, caps[i]);
else
UNSET_CAPABILITY(mask, caps[i]);
return (0); return (0);
} }

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD$
*/ */
/* /*
* TrustedBSD Project - support for POSIX.1e process capabilities * TrustedBSD Project - support for POSIX.1e process capabilities
@ -55,7 +55,10 @@ cap_set_flag(cap_t cap_p, cap_flag_t flag, int ncap, cap_value_t caps[],
} }
for (i = 0; i < ncap; i++) for (i = 0; i < ncap; i++)
SET_CAPABILITY(mask, caps[i]); if (value == CAP_SET)
SET_CAPABILITY(mask, caps[i]);
else
UNSET_CAPABILITY(mask, caps[i]);
return (0); return (0);
} }