capsicum: use new helpers

This commit is contained in:
Mateusz Guzik 2020-02-15 01:30:27 +00:00
parent 445faddf7f
commit eb40664d83
2 changed files with 44 additions and 44 deletions

View File

@ -103,50 +103,50 @@ __read_mostly cap_rights_t cap_no_rights;
static void
__cap_rights_sysinit1(void *arg)
{
cap_rights_init(&cap_accept_rights, CAP_ACCEPT);
cap_rights_init(&cap_bind_rights, CAP_BIND);
cap_rights_init(&cap_connect_rights, CAP_CONNECT);
cap_rights_init(&cap_event_rights, CAP_EVENT);
cap_rights_init(&cap_fchdir_rights, CAP_FCHDIR);
cap_rights_init(&cap_fchflags_rights, CAP_FCHFLAGS);
cap_rights_init(&cap_fchmod_rights, CAP_FCHMOD);
cap_rights_init(&cap_fchown_rights, CAP_FCHOWN);
cap_rights_init(&cap_fcntl_rights, CAP_FCNTL);
cap_rights_init(&cap_fexecve_rights, CAP_FEXECVE);
cap_rights_init(&cap_flock_rights, CAP_FLOCK);
cap_rights_init(&cap_fpathconf_rights, CAP_FPATHCONF);
cap_rights_init(&cap_fstat_rights, CAP_FSTAT);
cap_rights_init(&cap_fstatfs_rights, CAP_FSTATFS);
cap_rights_init(&cap_fsync_rights, CAP_FSYNC);
cap_rights_init(&cap_ftruncate_rights, CAP_FTRUNCATE);
cap_rights_init(&cap_futimes_rights, CAP_FUTIMES);
cap_rights_init(&cap_getpeername_rights, CAP_GETPEERNAME);
cap_rights_init(&cap_getsockname_rights, CAP_GETSOCKNAME);
cap_rights_init(&cap_getsockopt_rights, CAP_GETSOCKOPT);
cap_rights_init(&cap_ioctl_rights, CAP_IOCTL);
cap_rights_init(&cap_linkat_source_rights, CAP_LINKAT_SOURCE);
cap_rights_init(&cap_linkat_target_rights, CAP_LINKAT_TARGET);
cap_rights_init(&cap_listen_rights, CAP_LISTEN);
cap_rights_init(&cap_mkdirat_rights, CAP_MKDIRAT);
cap_rights_init(&cap_mkfifoat_rights, CAP_MKFIFOAT);
cap_rights_init(&cap_mknodat_rights, CAP_MKNODAT);
cap_rights_init(&cap_mmap_rights, CAP_MMAP);
cap_rights_init(&cap_pdgetpid_rights, CAP_PDGETPID);
cap_rights_init(&cap_pdkill_rights, CAP_PDKILL);
cap_rights_init(&cap_pread_rights, CAP_PREAD);
cap_rights_init(&cap_pwrite_rights, CAP_PWRITE);
cap_rights_init(&cap_read_rights, CAP_READ);
cap_rights_init(&cap_recv_rights, CAP_RECV);
cap_rights_init(&cap_renameat_source_rights, CAP_RENAMEAT_SOURCE);
cap_rights_init(&cap_renameat_target_rights, CAP_RENAMEAT_TARGET);
cap_rights_init(&cap_seek_rights, CAP_SEEK);
cap_rights_init(&cap_send_rights, CAP_SEND);
cap_rights_init_one(&cap_accept_rights, CAP_ACCEPT);
cap_rights_init_one(&cap_bind_rights, CAP_BIND);
cap_rights_init_one(&cap_connect_rights, CAP_CONNECT);
cap_rights_init_one(&cap_event_rights, CAP_EVENT);
cap_rights_init_one(&cap_fchdir_rights, CAP_FCHDIR);
cap_rights_init_one(&cap_fchflags_rights, CAP_FCHFLAGS);
cap_rights_init_one(&cap_fchmod_rights, CAP_FCHMOD);
cap_rights_init_one(&cap_fchown_rights, CAP_FCHOWN);
cap_rights_init_one(&cap_fcntl_rights, CAP_FCNTL);
cap_rights_init_one(&cap_fexecve_rights, CAP_FEXECVE);
cap_rights_init_one(&cap_flock_rights, CAP_FLOCK);
cap_rights_init_one(&cap_fpathconf_rights, CAP_FPATHCONF);
cap_rights_init_one(&cap_fstat_rights, CAP_FSTAT);
cap_rights_init_one(&cap_fstatfs_rights, CAP_FSTATFS);
cap_rights_init_one(&cap_fsync_rights, CAP_FSYNC);
cap_rights_init_one(&cap_ftruncate_rights, CAP_FTRUNCATE);
cap_rights_init_one(&cap_futimes_rights, CAP_FUTIMES);
cap_rights_init_one(&cap_getpeername_rights, CAP_GETPEERNAME);
cap_rights_init_one(&cap_getsockname_rights, CAP_GETSOCKNAME);
cap_rights_init_one(&cap_getsockopt_rights, CAP_GETSOCKOPT);
cap_rights_init_one(&cap_ioctl_rights, CAP_IOCTL);
cap_rights_init_one(&cap_linkat_source_rights, CAP_LINKAT_SOURCE);
cap_rights_init_one(&cap_linkat_target_rights, CAP_LINKAT_TARGET);
cap_rights_init_one(&cap_listen_rights, CAP_LISTEN);
cap_rights_init_one(&cap_mkdirat_rights, CAP_MKDIRAT);
cap_rights_init_one(&cap_mkfifoat_rights, CAP_MKFIFOAT);
cap_rights_init_one(&cap_mknodat_rights, CAP_MKNODAT);
cap_rights_init_one(&cap_mmap_rights, CAP_MMAP);
cap_rights_init_one(&cap_pdgetpid_rights, CAP_PDGETPID);
cap_rights_init_one(&cap_pdkill_rights, CAP_PDKILL);
cap_rights_init_one(&cap_pread_rights, CAP_PREAD);
cap_rights_init_one(&cap_pwrite_rights, CAP_PWRITE);
cap_rights_init_one(&cap_read_rights, CAP_READ);
cap_rights_init_one(&cap_recv_rights, CAP_RECV);
cap_rights_init_one(&cap_renameat_source_rights, CAP_RENAMEAT_SOURCE);
cap_rights_init_one(&cap_renameat_target_rights, CAP_RENAMEAT_TARGET);
cap_rights_init_one(&cap_seek_rights, CAP_SEEK);
cap_rights_init_one(&cap_send_rights, CAP_SEND);
cap_rights_init(&cap_send_connect_rights, CAP_SEND, CAP_CONNECT);
cap_rights_init(&cap_setsockopt_rights, CAP_SETSOCKOPT);
cap_rights_init(&cap_shutdown_rights, CAP_SHUTDOWN);
cap_rights_init(&cap_symlinkat_rights, CAP_SYMLINKAT);
cap_rights_init(&cap_unlinkat_rights, CAP_UNLINKAT);
cap_rights_init(&cap_write_rights, CAP_WRITE);
cap_rights_init_one(&cap_setsockopt_rights, CAP_SETSOCKOPT);
cap_rights_init_one(&cap_shutdown_rights, CAP_SHUTDOWN);
cap_rights_init_one(&cap_symlinkat_rights, CAP_SYMLINKAT);
cap_rights_init_one(&cap_unlinkat_rights, CAP_UNLINKAT);
cap_rights_init_one(&cap_write_rights, CAP_WRITE);
cap_rights_init(&cap_no_rights);
}
SYSINIT(cap_rights1_sysinit, SI_SUB_COPYRIGHT, SI_ORDER_ANY, \

View File

@ -267,7 +267,7 @@ sys_cap_rights_limit(struct thread *td, struct cap_rights_limit_args *uap)
cap_rights_t rights;
int error, version;
cap_rights_init(&rights);
cap_rights_init_zero(&rights);
error = copyin(uap->rightsp, &rights, sizeof(rights.cr_rights[0]));
if (error != 0)