| 133 | } |
| 134 | |
| 135 | int |
| 136 | mac_execve_enter(struct image_params *imgp, struct mac *mac_p) |
| 137 | { |
| 138 | struct label *label; |
| 139 | struct mac mac; |
| 140 | char *buffer; |
| 141 | int error; |
| 142 | |
| 143 | if (mac_p == NULL) |
| 144 | return (0); |
| 145 | |
| 146 | if (!(mac_labeled & MPC_OBJECT_CRED)) |
| 147 | return (EINVAL); |
| 148 | |
| 149 | error = copyin(mac_p, &mac, sizeof(mac)); |
| 150 | if (error) |
| 151 | return (error); |
| 152 | |
| 153 | error = mac_check_structmac_consistent(&mac); |
| 154 | if (error) |
| 155 | return (error); |
| 156 | |
| 157 | buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); |
| 158 | error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); |
| 159 | if (error) { |
| 160 | free(buffer, M_MACTEMP); |
| 161 | return (error); |
| 162 | } |
| 163 | |
| 164 | label = mac_cred_label_alloc(); |
| 165 | error = mac_cred_internalize_label(label, buffer); |
| 166 | free(buffer, M_MACTEMP); |
| 167 | if (error) { |
| 168 | mac_cred_label_free(label); |
| 169 | return (error); |
| 170 | } |
| 171 | imgp->execlabel = label; |
| 172 | return (0); |
| 173 | } |
| 174 | |
| 175 | void |
| 176 | mac_execve_exit(struct image_params *imgp) |
no test coverage detected