2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * adt.h
2N/A *
2N/A * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A *
2N/A * This is a contract private interface and is subject to change
2N/A */
2N/A
2N/A#ifndef _ADT_H
2N/A#define _ADT_H
2N/A
2N/A#include <bsm/audit.h>
2N/A#include <bsm/libbsm.h>
2N/A#include <bsm/audit_record.h>
2N/A#include <bsm/audit_uevents.h>
2N/A#include <door.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define ADT_STRING_MAX 511 /* max non-null characters */
2N/A#define ADT_NO_ATTRIB (uid_t)-1 /* unattributed user */
2N/A#define ADT_NO_CHANGE (uid_t)-2 /* no update for this parameter */
2N/A#define ADT_NO_AUDIT (uid_t)-3 /* unaudited user */
2N/A
2N/A/*
2N/A * terminal id types
2N/A */
2N/A#define ADT_IPv4 1
2N/A#define ADT_IPv6 2
2N/A
2N/A/*
2N/A * for adt_set_user(): ADT_NEW if creating a session for a newly
2N/A * authenticated user -- login -- and ADT_UPDATE if an authenticated
2N/A * user is changing uid/gid -- e.g., su. ADT_USER changes only the
2N/A * ruid / euid / rgid / egid values and is appropriate for login-like
2N/A * operations where PAM has already set the audit context in the cred.
2N/A * ADT_SETTID is for the special case where it is necessary to store
2N/A * the terminal id in the credential before forking to the login or
2N/A * login-like process.
2N/A */
2N/Aenum adt_user_context {ADT_NEW, ADT_UPDATE, ADT_USER, ADT_SETTID};
2N/A
2N/Atypedef ulong_t adt_session_flags_t;
2N/Atypedef struct adt_session_data adt_session_data_t;
2N/Atypedef struct adt_export_data adt_export_data_t;
2N/Atypedef union adt_event_data adt_event_data_t;
2N/Atypedef struct adt_termid adt_termid_t;
2N/Atypedef struct translation adt_translation_t;
2N/Atypedef struct stat64 adt_stat_t;
2N/A
2N/A/*
2N/A * flag defs for the flags argument of adt_start_session()
2N/A */
2N/A
2N/A#define ADT_BUFFER_RECORDS 0x2 /* server buffering */
2N/A#define ADT_USE_PROC_DATA 0x1 /* copy audit char's from proc */
2N/A /* | all of above = ADT_FLAGS_ALL */
2N/A#define ADT_FLAGS_ALL ADT_BUFFER_RECORDS | \
2N/A ADT_USE_PROC_DATA
2N/A
2N/A/*
2N/A * Functions
2N/A */
2N/A
2N/Aextern int adt_start_session(adt_session_data_t **,
2N/A const adt_export_data_t *,
2N/A adt_session_flags_t);
2N/Aextern int adt_end_session(adt_session_data_t *);
2N/Aextern int adt_dup_session(const adt_session_data_t *,
2N/A adt_session_data_t **);
2N/A
2N/Aextern int adt_set_proc(const adt_session_data_t *);
2N/Aextern int adt_set_user(const adt_session_data_t *, uid_t, gid_t,
2N/A uid_t, gid_t, const adt_termid_t *,
2N/A enum adt_user_context);
2N/Aextern int adt_set_from_ucred(const adt_session_data_t *,
2N/A const ucred_t *,
2N/A enum adt_user_context);
2N/A
2N/Aextern size_t adt_get_session_id(const adt_session_data_t *, char **);
2N/A
2N/Aextern size_t adt_export_session_data(const adt_session_data_t *,
2N/A adt_export_data_t **);
2N/A
2N/Aextern adt_event_data_t
2N/A *adt_alloc_event(const adt_session_data_t *, au_event_t);
2N/A
2N/Aextern int adt_put_event(const adt_event_data_t *, int, int);
2N/Aextern void adt_free_event(adt_event_data_t *);
2N/A
2N/Aextern int adt_load_termid(int, adt_termid_t **);
2N/Aextern int adt_load_hostname(const char *, adt_termid_t **);
2N/Aextern int adt_load_ttyname(const char *, adt_termid_t **);
2N/A
2N/Aextern boolean_t adt_audit_state(int);
2N/A
2N/A/*
2N/A * Special typedefs for translations.
2N/A */
2N/A
2N/Atypedef int fd_t; /* file descriptor */
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _ADT_H */