AU_MASK(3)
π au_mask β bestie's guide to audit mask conversions β¨
okay so this page is from the Library Functions Manual, and it lives in section 3 (au_mask(3)) β it's the glow-up guide to the au_preselect, getauditflagsbin and getauditflagschar girlies. buckle up π
πΈ NAME πΈ
au_preselect, getauditflagsbin, getauditflagschar β the trio that converts between the string and numeric values of audit masks. literally the translators of the audit world π«Ά
π¦ LIBRARY π¦
Basic Security Module Library β libbsm, and you link it with -lbsm. iconic. π
β¨ SYNOPSIS β¨
#include <bsm/libbsm.h>
int
au_preselect(au_event_t event, au_mask_t *mask_p, int sorf, int flag);
int
getauditflagsbin(char *auditstr, au_mask_t *masks);
int
getauditflagschar(char *auditstr, au_mask_t *masks, int verbose);
no cap, that's the whole vibe check right there π
π DESCRIPTION π
these interfaces are here to support processing of an audit mask β that's a thing of type au_mask_t, iykyk β and they handle the conversion between numeric and text formats, plus figuring out whether or not a mask actually matches an event. three jobs, all slaying. π₯
π§ au_preselect()
this one calculates whether or not the audit event passed via event is matched by the audit mask passed via mask_p.
the sorf argument tells it whether or not to consider the event as a success β if the AU_PRS_SUCCESS flag is set β or failure β if the AU_PRS_FAILURE flag is set.
and then the flag argument accepts extra arguments that influence the behavior of au_preselect(), specifically:
AU_PRS_REREADβ causes the event to be re-looked up rather than read from the cache πAU_PRS_USECACHEβ forces use of the cache β‘
π getauditflagsbin()
converts a string representation of an audit mask β passed via a character string that auditstr points to β and returns the resulting mask, if it's valid, via *masks. love that for us π
π getauditflagschar()
takes the audit event mask passed via *masks and converts it to a character string in a buffer pointed to by auditstr. π
β οΈ bestie please read the "BUGS" section about how to provide a buffer of sufficient size. this is not a drill π
if the verbose flag is set, the class description string retrieved from audit_class(5) gets used; otherwise it's the two-character class name. two modes, both valid, we stan. β¨
π IMPLEMENTATION NOTES π
au_preselect() makes implicit use of various audit database routines, and it may influence the behavior of simultaneous or interleaved processing of those databases by other code. so likeβ¦ it's not just vibing in its own lane, it's lowkey touching shared state. noted. π
π RETURN VALUES π
au_preselect()
- returns
0on success - returns
-1if there's a failure looking up the event type or other database access β in which caseerrnowill be set to indicate the error - returns
1if the event is matched;0if it's not
getauditflagsbin() and getauditflagschar()
- return the value
0if successful - otherwise the value
-1is returned and the global variableerrnois set to indicate the error
periodt. π
π SEE ALSO π
β 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. a real main-character origin story ngl π
π«Ά 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. absolute icons, all three of them. π
and the Basic Security Module (BSM) interface to audit records and the audit event stream format were defined by Sun Microsystems. the OGs. π
π BUGS π
- the
errnovariable may not always be properly set in the event of an error. π like, it might, but don't count on it. getauditflagschar()does not provide a way to indicate how long the character buffer is, in order to detect overflow. π as a result, the caller must always provide a buffer of sufficient length for any possible mask β which may be calculated as three times the number of non-zero bits in themaskargument in the event non-verbose class names are used, and is not trivially predictable for verbose class names. this API should be replaced with a more robust one. π©
π¨ fr fr, do the math before you pass that buffer. this is the dangerous part of the page.
okay that's the whole thing! stay safe out there with your audit masks, bestie πβ¨
β cute little sign-off: this page came from Debian, dated April 19, 2005, and yeah the header said AU_MASK(3) at the top and the same down at the bottom. mwah ππΈ
π¦ where this page comes from
- nixos 26.05: openbsm 1.1
- nixpkgs unstable: openbsm 1.1
- Copyright (c) 2005 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms