getaident(3) — LIBRARY FUNCTIONS
NAME
getaident, getaiduser, setaident, endaident, fgetaident − gets authentication ID
SYNOPSIS
#include <audit_id.h>
#include <stdio.h>
struct audit_id ∗getaident ()
struct audit_id ∗getaiduser (uid, uname)
uid_t uid;
char ∗uname;
int setaident ()
void endaident ()
struct audit_id ∗fgetaident (f)
FILE ∗f;
DESCRIPTION
getaident and getaiduser both return a pointer to an object with the audit_id structure containing the fields of a line in the /var/security/audit_id file. Each line in the file corresponds to an audit_id structure, declared in the <audit_id.h> header file:
struct audit_id {
uid_t aid; /∗ unique audit ID ∗/
uid_t uid; /∗ user’s ID ∗/
char ∗ uname; /∗ user’s login name ∗/
char ∗ fname; /∗ user’s full name (comment) ∗/
};
The fields have the meanings defined in audit_id(4).
getaident, when first called, returns a pointer to the first audit_id structure in the file. Thereafter, it returns a pointer to the next audit_id structure in the file, so successive calls can be used to search the entire file.
getaiduser searches backwards from the end of the file until a line with a user ID matching uid and a user login name matching uname 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 two preceding functions will return a NULL pointer.
If the audit ID file is already open, a call to setaident will have the effect of rewinding the audit ID file to allow repeated searches. Otherwise, setaident will open the audit ID file.
endaident is called to close the audit ID file when processing is complete.
fgetaident returns a pointer to the next audit_id structure that matches the format of /var/security/audit_id in the stream f.
Lines in the audit ID file that are blank or begin with a pound character (#) are ignored.
FILES
/var/security/audit_idaudit ID file
SEE ALSO
adduser(1M), passmgmt(1M), login(1), audit_id(4)
DIAGNOSTICS
A NULL pointer is returned on EOF or error, except for setaident 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)