MCPcopy Create free account
hub / github.com/F-Stack/f-stack / audit_pipe_preselect_set

Function audit_pipe_preselect_set

freebsd/security/audit/audit_pipe.c:312–334  ·  view source on GitHub ↗

* Set the per-pipe mask for a specific auid. Add a new entry if needed; * otherwise, update the current entry. */

Source from the content-addressed store, hash-verified

310 * otherwise, update the current entry.
311 */
312static void
313audit_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.

Callers 1

audit_pipe_ioctlFunction · 0.85

Calls 3

mallocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected