* Set the per-pipe mask for a specific auid. Add a new entry if needed; * otherwise, update the current entry. */
| 310 | * otherwise, update the current entry. |
| 311 | */ |
| 312 | static void |
| 313 | audit_pipe_preselect_set(struct audit_pipe *ap, au_id_t auid, au_mask_t mask) |
| 314 | { |
| 315 | struct audit_pipe_preselect *app, *app_new; |
| 316 | |
| 317 | /* |
| 318 | * Pessimistically assume that the auid doesn't already have a mask |
| 319 | * set, and allocate. We will free it if it is unneeded. |
| 320 | */ |
| 321 | app_new = malloc(sizeof(*app_new), M_AUDIT_PIPE_PRESELECT, M_WAITOK); |
| 322 | AUDIT_PIPE_LOCK(ap); |
| 323 | app = audit_pipe_preselect_find(ap, auid); |
| 324 | if (app == NULL) { |
| 325 | app = app_new; |
| 326 | app_new = NULL; |
| 327 | app->app_auid = auid; |
| 328 | TAILQ_INSERT_TAIL(&ap->ap_preselect_list, app, app_list); |
| 329 | } |
| 330 | app->app_mask = mask; |
| 331 | AUDIT_PIPE_UNLOCK(ap); |
| 332 | if (app_new != NULL) |
| 333 | free(app_new, M_AUDIT_PIPE_PRESELECT); |
| 334 | } |
| 335 | |
| 336 | /* |
| 337 | * Delete a per-auid mask on an audit pipe. |
no test coverage detected