---
name: "getauuserent"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/au_user"
---

# getauuserent(3)

look up information from the audit\_user database

Part of [au\_user(3)](/au_user/3.md).

## NAME

**setauuser**, **endauuser**, **getauuserent**, **getauuserent\_r**, **getauusernam**, **getauusernam\_r**, **au\_user\_mask**, **getfauditflags** – look up information from the audit\_user database

## LIBRARY

library “libbsm”

## SYNOPSIS

**#include \<bsm/libbsm.h\>**

*void*\

**setauuser**(*void*);

*void*\

**endauuser**(*void*);

*struct au\_user\_ent \**\

**getauuserent**(*void*);

*struct au\_user\_ent \**\

**getauuserent\_r**(*struct au\_user\_ent \*u*);

*struct au\_user\_ent \**\

**getauusernam**(*const char \*name*);

*struct au\_user\_ent \**\

**getauusernam\_r**(*struct au\_user\_ent \*u*, *const char \*name*);

*int*\

**au\_user\_mask**(*char \*username*, *au\_mask\_t \*mask\_p*);

*int*\

**getfauditflags**(*au\_mask\_t \*usremask*, *au\_mask\_t \*usrdmask*, *au\_mask\_t \*lastmask*);

## DESCRIPTION

These interfaces may be used to look up information from the [audit\_user(5)](/audit_user/5.md) database, which describes per-user audit configuration. Audit user entries are described by a *au\_user\_ent*, which stores the user's name in *au\_name*, events to always audit in *au\_always*, and events never to audit *au\_never*.

The **getauuserent**() function returns the next user found in the [audit\_user(5)](/audit_user/5.md) database, or the first if the function has not yet been called. NULL will be returned if no further records are available.

The **getauusernam**() function looks up a user by name. NULL will be returned if no matching class can be found.

The **setauuser**() function resets the iterator through the [audit\_user(5)](/audit_user/5.md) database, causing the next call to **getauuserent**() to start again from the beginning of the file.

The **endauuser**() function closes the [audit\_user(5)](/audit_user/5.md) database, if open.

The **au\_user\_mask**() function calculates a new session audit mask to be returned via *mask\_p* for the user identified by *username*. If the user audit configuration is not found, the default system audit properties returned by [getacflg(3)](/getacflg/3.md) are used. The resulting mask may be set via a call to [setaudit(2)](/setaudit/2.md) or related variants.

The **getfauditflags**() function generates a new process audit state by combining the audit masks passed as parameters with the system audit masks.

## SEE ALSO

[setaudit(2)](/setaudit/2.md), [getacflg(3)](/getacflg/3.md), [libbsm(3)](/libbsm/3.md), [audit\_user(5)](/audit_user/5.md)

## HISTORY

The OpenBSM implementation was created by McAfee Research, the security division of McAfee Inc., under contract to Apple Computer, Inc., in 2004. It was subsequently adopted by the TrustedBSD Project as the foundation for the OpenBSM distribution.

## AUTHORS

This software was created by Robert Watson, Wayne Salamon, and Suresh Krishnaswamy for McAfee Research, the security research division of McAfee, Inc., under contract to Apple Computer, Inc.

The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems.

## BUGS

These routines cannot currently distinguish between an entry not being found and an error accessing the database. The implementation should be changed to return an error via *errno* when NULL is returned.
