| 144 | } |
| 145 | |
| 146 | int |
| 147 | mac_socket_init(struct socket *so, int flag) |
| 148 | { |
| 149 | |
| 150 | if (mac_labeled & MPC_OBJECT_SOCKET) { |
| 151 | so->so_label = mac_socket_label_alloc(flag); |
| 152 | if (so->so_label == NULL) |
| 153 | return (ENOMEM); |
| 154 | so->so_peerlabel = mac_socketpeer_label_alloc(flag); |
| 155 | if (so->so_peerlabel == NULL) { |
| 156 | mac_socket_label_free(so->so_label); |
| 157 | so->so_label = NULL; |
| 158 | return (ENOMEM); |
| 159 | } |
| 160 | } else { |
| 161 | so->so_label = NULL; |
| 162 | so->so_peerlabel = NULL; |
| 163 | } |
| 164 | return (0); |
| 165 | } |
| 166 | |
| 167 | void |
| 168 | mac_socket_label_free(struct label *label) |
no test coverage detected