[Bug 277057] rights(4): Not all rights may be specified in a rights mask

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 14 Feb 2024 22:00:24 UTC

Mark Johnston <markj@FreeBSD.org> changed:

           What    |Removed                     |Added
                 CC|                            |markj@FreeBSD.org

--- Comment #2 from Mark Johnston <markj@FreeBSD.org> ---
> 144:	    cap_rights_init(&rights, CAP_READ | CAP_FSTAT | CAP_FCNTL | CAP_SEEK),

But the right(!) way to write this is cap_rights_init(&rights, CAP_READ,
CAP_FSTAT, ...).  I'd expect that to work for mixed-index rights.  If it
doesn't that's certainly a bug.

Most of the code in the tree does this properly (and at least one of the few
exceptions is my fault, sorry).  Using plain OR works except when it doesn't,
as you note.  Maybe rights(4) should be more clear.

cap_rights_set() should be used to incrementally add rights to a set.

You are receiving this mail because:
You are the assignee for the bug.