getament(3) — LIBRARY FUNCTIONS
NAME
getament, getamuid, getamnam, setament, endament, fgetament − gets audit mask entry
SYNOPSIS
#include <aumask.h>
#include <stdio.h>
aumask ∗getament ()
aumask ∗getamuid (uid)
uid_t uid;
aumask ∗getamnam (name)
char ∗name;
int setament ()
void endament ()
aumask ∗fgetament (f)
FILE ∗f;
DESCRIPTION
getament, getamuid, and getamnam each return a pointer to an object with the aumask structure containing the processed fields of a line in the /var/security/aumask file. Each line in the file corresponds to an aumask structure, declared in the <aumask.h> header file:
struct aumask
{
char ∗am_name;
char ∗am_aumaskstr;
aumask_t am_aumask;
};
typedef uchar aumask_t[AU_MAX_CLASS + 1];
The fields have the meanings defined in aumask(4).
getament, when first called, returns a pointer to the first aumask structure in the file. Thereafter, it returns a pointer to the next aumask structure in the file, so successive calls can be used to search the entire file.
getamuid searches from the beginning of the file until a numerical user ID matching uid is found and returns a pointer to the particular structure in which it was found.
getamnam searches from the beginning of the file until a user name matching name is found and returns a pointer to the particular structure in which it was found.
If an end-of-file or an error is encountered on reading, the three preceding functions will return a NULL pointer.
If the audit mask file is already open, a call to setament will have the effect of rewinding the audit mask file to allow repeated searches. Otherwise, setament will open the audit mask file.
endament is called to close the audit mask file when processing is complete.
fgetament returns a pointer to the next aumask structure that matches the format of /var/security/aumask in the stream f.
Lines in the audit mask file that are blank or begin with a pound character (#) are ignored.
Except for endament, these functions all require super-user privilege.
FILES
/var/security/aumaskaudit mask file
SEE ALSO
aumaskmgmt(1M), a_create_mask(3A), aumask(4)
DIAGNOSTICS
A NULL pointer is returned on EOF or error, except for setament which returns -1 on error.
WARNINGS
The above routines use <stdio.h>, which causes them to increase the size of programs more than might be expected if the programs do not otherwise use standard I/O.
All information is contained in a static area, so it must be copied if it is to be saved.
(Security Enhancement)