Lines Matching full:error
102 int error; in mac_label_copyin_impl() local
108 error = copyin(u_mac, &mac32, sizeof(mac32)); in mac_label_copyin_impl()
109 if (error != 0) in mac_label_copyin_impl()
110 return (error); in mac_label_copyin_impl()
117 error = copyin(u_mac, mac, sizeof(*mac)); in mac_label_copyin_impl()
118 if (error != 0) in mac_label_copyin_impl()
119 return (error); in mac_label_copyin_impl()
122 error = mac_check_structmac_consistent(mac); in mac_label_copyin_impl()
123 if (error != 0) in mac_label_copyin_impl()
124 return (error); in mac_label_copyin_impl()
128 error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); in mac_label_copyin_impl()
129 if (error != 0) { in mac_label_copyin_impl()
131 return (error); in mac_label_copyin_impl()
134 MPASS(error == 0); in mac_label_copyin_impl()
170 int error; in sys___mac_get_pid() local
172 error = mac_label_copyin(uap->mac_p, &mac, &u_buffer); in sys___mac_get_pid()
173 if (error) in sys___mac_get_pid()
174 return (error); in sys___mac_get_pid()
178 error = ESRCH; in sys___mac_get_pid()
183 error = p_cansee(td, tproc); in sys___mac_get_pid()
184 if (error == 0) in sys___mac_get_pid()
187 if (error) in sys___mac_get_pid()
191 error = mac_cred_externalize_label(tcred->cr_label, mac.m_string, in sys___mac_get_pid()
193 if (error == 0) in sys___mac_get_pid()
194 error = copyout(buffer, u_buffer, strlen(buffer)+1); in sys___mac_get_pid()
200 return (error); in sys___mac_get_pid()
208 int error; in sys___mac_get_proc() local
210 error = mac_label_copyin(uap->mac_p, &mac, &u_buffer); in sys___mac_get_proc()
211 if (error) in sys___mac_get_proc()
212 return (error); in sys___mac_get_proc()
215 error = mac_cred_externalize_label(td->td_ucred->cr_label, in sys___mac_get_proc()
217 if (error == 0) in sys___mac_get_proc()
218 error = copyout(buffer, u_buffer, strlen(buffer)+1); in sys___mac_get_proc()
222 return (error); in sys___mac_get_proc()
231 * is not set in case of error, and is set to a non-NULL value on success.
238 int error; in mac_set_proc_prepare() local
246 error = mac_cred_internalize_label(intlabel, mac->m_string); in mac_set_proc_prepare()
247 if (error) { in mac_set_proc_prepare()
249 return (error); in mac_set_proc_prepare()
265 * error occured under the process lock that obsoletes setting the MAC label).
273 int error; in mac_set_proc_core() local
278 error = mac_cred_check_relabel(p->p_ucred, intlabel); in mac_set_proc_core()
279 if (error) in mac_set_proc_core()
280 return (error); in mac_set_proc_core()
313 int error; in sys___mac_set_proc() local
315 error = mac_label_copyin(uap->mac_p, &mac, NULL); in sys___mac_set_proc()
316 if (error) in sys___mac_set_proc()
317 return (error); in sys___mac_set_proc()
319 error = mac_set_proc_prepare(td, &mac, &intlabel); in sys___mac_set_proc()
320 if (error) in sys___mac_set_proc()
329 error = mac_set_proc_core(td, newcred, intlabel); in sys___mac_set_proc()
330 if (error) { in sys___mac_set_proc()
342 mac_set_proc_finish(td, error == 0, intlabel); in sys___mac_set_proc()
345 return (error); in sys___mac_set_proc()
359 int error; in sys___mac_get_fd() local
361 error = mac_label_copyin(uap->mac_p, &mac, &u_buffer); in sys___mac_get_fd()
362 if (error) in sys___mac_get_fd()
363 return (error); in sys___mac_get_fd()
366 error = fget(td, uap->fd, cap_rights_init_one(&rights, CAP_MAC_GET), in sys___mac_get_fd()
368 if (error) in sys___mac_get_fd()
375 error = EINVAL; in sys___mac_get_fd()
383 error = mac_vnode_externalize_label(intlabel, mac.m_string, in sys___mac_get_fd()
390 error = EINVAL; in sys___mac_get_fd()
398 error = mac_pipe_externalize_label(intlabel, mac.m_string, in sys___mac_get_fd()
405 error = EINVAL; in sys___mac_get_fd()
413 error = mac_socket_externalize_label(intlabel, mac.m_string, in sys___mac_get_fd()
419 error = EINVAL; in sys___mac_get_fd()
421 if (error == 0) in sys___mac_get_fd()
422 error = copyout(buffer, u_buffer, strlen(buffer)+1); in sys___mac_get_fd()
428 return (error); in sys___mac_get_fd()
453 int error; in kern___mac_get_path() local
458 error = mac_label_copyin(mac_p, &mac, &u_buffer); in kern___mac_get_path()
459 if (error) in kern___mac_get_path()
460 return (error); in kern___mac_get_path()
464 error = namei(&nd); in kern___mac_get_path()
465 if (error) in kern___mac_get_path()
470 error = mac_vnode_externalize_label(intlabel, mac.m_string, buffer, in kern___mac_get_path()
476 if (error == 0) in kern___mac_get_path()
477 error = copyout(buffer, u_buffer, strlen(buffer)+1); in kern___mac_get_path()
483 return (error); in kern___mac_get_path()
497 int error; in sys___mac_set_fd() local
499 error = mac_label_copyin(uap->mac_p, &mac, NULL); in sys___mac_set_fd()
500 if (error) in sys___mac_set_fd()
501 return (error); in sys___mac_set_fd()
503 error = fget(td, uap->fd, cap_rights_init_one(&rights, CAP_MAC_SET), in sys___mac_set_fd()
505 if (error) in sys___mac_set_fd()
512 error = EINVAL; in sys___mac_set_fd()
516 error = mac_vnode_internalize_label(intlabel, mac.m_string); in sys___mac_set_fd()
517 if (error) { in sys___mac_set_fd()
522 error = vn_start_write(vp, &mp, V_WAIT | V_PCATCH); in sys___mac_set_fd()
523 if (error != 0) { in sys___mac_set_fd()
528 error = vn_setlabel(vp, intlabel, td->td_ucred); in sys___mac_set_fd()
536 error = EINVAL; in sys___mac_set_fd()
540 error = mac_pipe_internalize_label(intlabel, mac.m_string); in sys___mac_set_fd()
541 if (error == 0) { in sys___mac_set_fd()
544 error = mac_pipe_label_set(td->td_ucred, in sys___mac_set_fd()
553 error = EINVAL; in sys___mac_set_fd()
557 error = mac_socket_internalize_label(intlabel, mac.m_string); in sys___mac_set_fd()
558 if (error == 0) { in sys___mac_set_fd()
560 error = mac_socket_label_set(td->td_ucred, so, in sys___mac_set_fd()
567 error = EINVAL; in sys___mac_set_fd()
573 return (error); in sys___mac_set_fd()
598 int error; in kern___mac_set_path() local
603 error = mac_label_copyin(mac_p, &mac, NULL); in kern___mac_set_path()
604 if (error) in kern___mac_set_path()
605 return (error); in kern___mac_set_path()
608 error = mac_vnode_internalize_label(intlabel, mac.m_string); in kern___mac_set_path()
610 if (error) in kern___mac_set_path()
614 error = namei(&nd); in kern___mac_set_path()
615 if (error == 0) { in kern___mac_set_path()
616 error = vn_start_write(nd.ni_vp, &mp, V_WAIT | V_PCATCH); in kern___mac_set_path()
617 if (error == 0) { in kern___mac_set_path()
618 error = vn_setlabel(nd.ni_vp, intlabel, in kern___mac_set_path()
627 return (error); in kern___mac_set_path()
635 int error; in sys_mac_syscall() local
637 error = copyinstr(uap->policy, target, sizeof(target), NULL); in sys_mac_syscall()
638 if (error) in sys_mac_syscall()
639 return (error); in sys_mac_syscall()
641 error = ENOSYS; in sys_mac_syscall()
645 error = mpc->mpc_ops->mpo_syscall(td, in sys_mac_syscall()
656 error = mpc->mpc_ops->mpo_syscall(td, in sys_mac_syscall()
664 return (error); in sys_mac_syscall()