Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

get_matching_autag_info(3AUDIT)

Name

get_matching_autag_info - get tag information for a binary audit record

Synopsis

cc [ flag...] file ... -laudit [library ...]

#include <security/libaudit.h>

nvlist_t *get_matching_autag_info(void *audit_record,
     char *tags_fname);

Description

The get_matching_autag_info() function returns an nvlist containing information about names of audit tags which the specified binary audit record matches. All nvpairs in the returned nvlist will be of the same name ("tagname"), and the values are all string type containing the tagname matched.

audit_record points to the binary audit record.

tags_fname specifies the tags file name to be used. If NULL is specified, then the default audit tags are used.

Return Values

Upon successful completion, an nvlist is allocated and the address is returned. Otherwise, NULL is returned if no tags are found or if an error occurs. If an error occurs, errno is set to indicate the error.

The caller must call the nvlist_free() function to deallocate any returned nvlist. For more information, see the nvlist_free(3NVPAIR) man page.

Errors

The get_matching_autag_info() function will fail if:

ENOENT

The specified tag file is not found or is not a regular file.

EACCES

The specified tag file is not accessible.

EINVAL

An error occurred while parsing the audit record argument.

Examples

Example 1 Get all tag names that a binary audit record matches
#include <security/libaudit.h>
#include <errno.h>

int error;
nvlist_t *list;
nvpair_t *pair = NULL;
char *tagname;
    .
    .
    .
errno = 0;
if ((list = get_matching_autag_info(record, NULL)) == NULL) {
        if (errno != 0) {
                perror("get_matching_autag_info");
                exit(1);
        }
        return (0);
}
while ((pair = nvlist_next_nvpair(list, pair)) != NULL) {
        error = nvpair_value_string(pair, &tagname);
        .
        .
        .
}
nvlist_free(list);

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Uncommitted
MT-Level
MT-Safe

See Also

libnvpair(3LIB), audit_tags(5), audit.log(5), attributes(7)

History

The get_matching_autag_info() function was added in Oracle Solaris 11.4.0.