| 131 | } |
| 132 | |
| 133 | int |
| 134 | sys___mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) |
| 135 | { |
| 136 | char *elements, *buffer; |
| 137 | struct mac mac; |
| 138 | int error; |
| 139 | |
| 140 | error = copyin(uap->mac_p, &mac, sizeof(mac)); |
| 141 | if (error) |
| 142 | return (error); |
| 143 | |
| 144 | error = mac_check_structmac_consistent(&mac); |
| 145 | if (error) |
| 146 | return (error); |
| 147 | |
| 148 | elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); |
| 149 | error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); |
| 150 | if (error) { |
| 151 | free(elements, M_MACTEMP); |
| 152 | return (error); |
| 153 | } |
| 154 | |
| 155 | buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); |
| 156 | error = mac_cred_externalize_label(td->td_ucred->cr_label, |
| 157 | elements, buffer, mac.m_buflen); |
| 158 | if (error == 0) |
| 159 | error = copyout(buffer, mac.m_string, strlen(buffer)+1); |
| 160 | |
| 161 | free(buffer, M_MACTEMP); |
| 162 | free(elements, M_MACTEMP); |
| 163 | return (error); |
| 164 | } |
| 165 | |
| 166 | int |
| 167 | sys___mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) |
nothing calls this directly
no test coverage detected