subr_capability.c (8a656309b396482b40b5e78a1c47b5d06d85fd58) subr_capability.c (bcd1cf4f039b0d6a23363b0d62e0898ac07b3d97)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2013 FreeBSD Foundation
5 * All rights reserved.
6 *
7 * This software was developed by Pawel Jakub Dawidek under sponsorship from
8 * the FreeBSD Foundation.

--- 380 unchanged lines hidden (view full) ---

389 ~(src->cr_rights[i] & 0x01FFFFFFFFFFFFFFULL);
390 }
391
392 assert(cap_rights_is_valid(src));
393 assert(cap_rights_is_valid(dst));
394
395 return (dst);
396}
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2013 FreeBSD Foundation
5 * All rights reserved.
6 *
7 * This software was developed by Pawel Jakub Dawidek under sponsorship from
8 * the FreeBSD Foundation.

--- 380 unchanged lines hidden (view full) ---

389 ~(src->cr_rights[i] & 0x01FFFFFFFFFFFFFFULL);
390 }
391
392 assert(cap_rights_is_valid(src));
393 assert(cap_rights_is_valid(dst));
394
395 return (dst);
396}
397
398bool
399cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little)
400{
401 unsigned int i, n;
402
403 assert(CAPVER(big) == CAP_RIGHTS_VERSION_00);
404 assert(CAPVER(little) == CAP_RIGHTS_VERSION_00);
405 assert(CAPVER(big) == CAPVER(little));
406
407 n = CAPARSIZE(big);
408 assert(n >= CAPARSIZE_MIN && n <= CAPARSIZE_MAX);
409
410 for (i = 0; i < n; i++) {
411 if ((big->cr_rights[i] & little->cr_rights[i]) !=
412 little->cr_rights[i]) {
413 return (false);
414 }
415 }
416
417 return (true);
418}