|
NAMEcap_rights_init , cap_rights_set ,
cap_rights_clear ,
cap_rights_is_set ,
cap_rights_is_valid ,
cap_rights_merge ,
cap_rights_remove ,
cap_rights_contains —
manage cap_rights_t structure
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <sys/capsicum.h>
cap_rights_t *
cap_rights_t *
cap_rights_t *
bool
bool
cap_rights_t *
cap_rights_t *
bool
DESCRIPTIONThe functions documented here allow to manage the cap_rights_t structure.Capability rights should be separated with comma when passed to
the cap_rights_set(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT, CAP_SEEK); The complete list of the capability rights can be found in the rights(4) manual page. The cap_rights_t rights; if (cap_rights_limit(fd, cap_rights_init(&rights, CAP_READ, CAP_WRITE)) < 0) err(1, "Unable to limit capability rights"); The The The The The The The RETURN VALUESThe functions never fail. In case an invalid capability right or an invalid cap_rights_t structure is given as an argument, the program will be aborted.The The The The The EXAMPLESThe following example demonstrates how to prepare a cap_rights_t structure to be passed to the cap_rights_limit(2) system call.cap_rights_t rights; int fd; fd = open("/tmp/foo", O_RDWR); if (fd < 0) err(1, "open() failed"); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); if (allow_write_and_seek) cap_rights_set(&rights, CAP_WRITE, CAP_SEEK); if (dont_allow_seek) cap_rights_clear(&rights, CAP_SEEK); if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) err(1, "cap_rights_limit() failed"); SEE ALSOcap_rights_limit(2), open(2), capsicum(4), rights(4)HISTORYThe functionscap_rights_init (),
cap_rights_set (),
cap_rights_clear (),
cap_rights_is_set (),
cap_rights_is_valid (),
cap_rights_merge (),
cap_rights_remove () and
cap_rights_contains () first appeared in
FreeBSD 8.3. Support for capabilities and capabilities
mode was developed as part of the TrustedBSD Project.
AUTHORSThis family of functions was created by Pawel Jakub Dawidek <pawel@dawidek.net> under sponsorship from the FreeBSD Foundation.
Visit the GSP FreeBSD Man Page Interface. |