auditwrite.c revision 388
749N/A#pragma ident "@(#)auditwrite.c 1.12 08/04/11 SMI"
749N/A#include "auditwrite.h"
749N/A#define AW_CTRLCMD_FLAGS \
749N/A#define AW_NOUSERDCMD_FLAGS \
749N/A#define AW_SUCCESS_RTN (0)
749N/A aw_restore(); \
749N/A return (AW_ERR_RTN); \
aw_restore(); \
return (AW_ERR_RTN); \
struct aw_context {
int old_cur_rd;
struct aw_rec {
int cmd_number;
int cmd_numargs;
} aw_cmd_table[] = {
{AW_END, 0},
{AW_ABORT, 0},
{AW_APPEND, 0},
{AW_DEFAULTRD, 0},
{AW_DISCARD, 0},
{AW_FLUSH, 0},
{AW_NOPRESELECT, 0},
{AW_NOQUEUE, 0},
{AW_NOSAVE, 0},
{AW_NOSERVER, 0},
{AW_SERVER, 0},
{AW_WRITE, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
{AW_END, 0},
static char *aw_errlist[] = {
static void aw_abort(void);
static void aw_cleanup(void);
static int aw_do_write(void);
static int aw_write_cleanup(void);
static void aw_queue_dealloc(void);
static int aw_queue_flush(void);
#ifdef NOTYET
static int aw_init(void);
static void aw_restore(void);
#ifdef DEBUG
extern int cannot_audit(int);
for (i = 0; i < (numargs); i++) \
for (i = 0; i < (numskips); i++) \
#ifdef DEBUG
return (AW_ERR_RTN);
aw_abort();
aw_restore();
return (AW_ERR_RTN);
#ifdef DEBUG
case AW_WRITE_FLAG:
case AW_APPEND_FLAG:
case AW_ABORT_FLAG:
aw_abort();
case AW_DEFAULTRD_FLAG:
case AW_DISCARD_FLAG:
for (i = 0; i < aw_num_recs; i++)
aw_rec_dealloc(i);
case AW_DISCARDRD_FLAG:
== AW_ERR_RTN)
case AW_FLUSH_FLAG:
case AW_GETRD_FLAG:
case AW_NOQUEUE_FLAG:
case AW_NOPRESELECT_FLAG: {
case AW_NOSAVE_FLAG:
case AW_NOSERVER_FLAG:
case AW_PRESELECT_FLAG:
case AW_QUEUE_FLAG:
case AW_SAVERD_FLAG:
case AW_SERVER_FLAG:
aw_abort();
#ifdef DEBUG
aw_restore();
#ifdef DEBUG
return (retval);
aw_abort(void)
uint_t i;
(void) aw_queue_flush();
for (i = 0; i < aw_num_recs; i++) {
(void) aw_audit_write(i);
aw_cleanup();
(void) closelog();
* thing, and doesn't have any name collisions...so far.
if (l2 == 0)
return (AW_SUCCESS_RTN);
return (AW_SUCCESS_RTN);
== (caddr_t)0)
return (AW_SUCCESS_RTN);
if (l2 == 0)
return (AW_SUCCESS_RTN);
return (AW_SUCCESS_RTN);
== (caddr_t)0)
return (AW_SUCCESS_RTN);
if (p == (caddr_t)0)
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
switch (arg) {
case AWD_BINARY:
case AWD_OCTAL:
case AWD_DECIMAL:
case AWD_HEX:
case AWD_STRING:
return (AW_SUCCESS_RTN);
return (AW_ERR_RTN);
switch (arg) {
case AWD_BYTE:
case AWD_CHAR:
case AWD_SHORT:
case AWD_INT:
case AWD_LONG:
case AWD_INT32:
case AWD_INT64:
return (AW_SUCCESS_RTN);
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
aw_cleanup(void)
for (i = 0; i < aw_num_recs; i++) {
aw_rec_dealloc(i);
int cmd;
return (AW_SUCCESS_RTN);
switch (arg) {
case AWD_BINARY:
return (AUP_BINARY);
case AWD_OCTAL:
return (AUP_OCTAL);
case AWD_DECIMAL:
return (AUP_DECIMAL);
case AWD_HEX:
return (AUP_HEX);
case AWD_STRING:
return (AUP_STRING);
switch (arg) {
case AWD_BYTE:
return (AUR_BYTE);
case AWD_CHAR:
return (AUR_CHAR);
case AWD_SHORT:
return (AUR_SHORT);
case AWD_INT:
return (AUR_INT);
case AWD_LONG:
return (AUR_INT32);
case AWD_INT32:
return (AUR_INT32);
case AWD_INT64:
return (AUR_INT64);
return (AW_SUCCESS_RTN);
== (token_t *)0)
AW_ERR_RTN) {
return (AW_ERR_RTN);
return (AW_ERR_RTN);
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
aw_do_write(void)
return (AW_ERR_RTN);
return (AW_ERR_RTN);
return (AW_ERR_RTN);
return (AW_ERR_RTN);
aw_write_cleanup(void)
return (AW_SUCCESS_RTN);
if (p != (caddr_t)0)
free((void *)p);
a = param;
while (a != AW_END) {
if (AW_IS_CONTROL_CMD(a)) {
case AW_ARG:
return (AW_ERR_RTN);
case AW_ATTR: {
return (AW_ERR_RTN);
case AW_DATA:
(token_t *)0)
return (AW_ERR_RTN);
case AW_EVENT:
case AW_EVENTNUM:
case AW_EXEC_ARGS:
== (token_t *)0)
return (AW_ERR_RTN);
case AW_EXEC_ENV:
== (token_t *)0)
return (AW_ERR_RTN);
case AW_EXIT:
return (AW_ERR_RTN);
case AW_GROUPS:
return (AW_ERR_RTN);
case AW_IN_ADDR:
return (AW_ERR_RTN);
case AW_IPC:
return (AW_ERR_RTN);
case AW_IPORT:
(token_t *)0)
return (AW_ERR_RTN);
case AW_OPAQUE:
return (AW_ERR_RTN);
case AW_PATH:
return (AW_ERR_RTN);
return (AW_ERR_RTN);
return (AW_ERR_RTN);
case AW_PRIVILEGE:
return (AW_ERR_RTN);
case AW_LEVEL:
case AW_SLABEL:
(token_t *)0)
return (AW_ERR_RTN);
case AW_PROCESS:
(token_t *)0)
return (AW_ERR_RTN);
case AW_PROCESS_EX:
(token_t *)0)
return (AW_ERR_RTN);
case AW_RETURN:
return (AW_ERR_RTN);
case AW_SOCKET:
(token_t *)0)
return (AW_ERR_RTN);
case AW_SUBJECT:
(token_t *)0)
return (AW_ERR_RTN);
case AW_SUBJECT_EX:
(token_t *)0)
return (AW_ERR_RTN);
case AW_USEOFPRIV:
return (AW_ERR_RTN);
case AW_TEXT:
return (AW_ERR_RTN);
case AW_UAUTH:
return (AW_ERR_RTN);
case AW_CMD: {
return (AW_ERR_RTN);
case AW_XATOM:
== (token_t *)0)
return (AW_ERR_RTN);
case AW_XCLIENT:
return (AW_ERR_RTN);
case AW_XCURSOR:
return (AW_ERR_RTN);
case AW_XCOLORMAP:
return (AW_ERR_RTN);
case AW_XFONT:
return (AW_ERR_RTN);
case AW_XGC:
return (AW_ERR_RTN);
case AW_XPIXMAP:
return (AW_ERR_RTN);
case AW_XPROPERTY:
(token_t *)0)
return (AW_ERR_RTN);
case AW_XSELECT:
return (AW_ERR_RTN);
case AW_XWINDOW:
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
a = param;
while (a != AW_END) {
if (AW_IS_DATA_CMD(a) &&
(a != AW_RETURN)) {
case AW_ABORT:
case AW_APPEND:
case AW_EVENT:
== (au_event_ent_t *)0)
case AW_EVENTNUM:
case AW_QUEUE:
aw_queue_hiwater == 0)
case AW_DEFAULTRD:
case AW_DISCARD:
case AW_DISCARDRD:
case AW_FLUSH:
case AW_GETRD:
case AW_NOPRESELECT:
case AW_NOQUEUE:
aw_queue_hiwater = 0;
case AW_NOSAVE:
case AW_NOSERVER:
case AW_PRESELECT:
sizeof (au_mask_t));
case AW_RETURN:
case AW_SAVERD:
case AW_SERVER:
case AW_USERD:
case AW_WRITE:
return (AW_SUCCESS_RTN);
aw_queue_dealloc(void)
aw_queue_bytes = 0;
aw_queue_flush(void)
if (aw_queue_bytes) {
aw_queue_bytes = 0;
return (AW_SUCCESS_RTN);
(void) aw_queue_flush();
return (AW_SUCCESS_RTN);
return (AW_ERR_RTN);
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
int slot;
return (AW_ERR_RTN);
*rdp = 0;
return (AW_SUCCESS_RTN);
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
(aw_rec_t **)0)
== (aw_rec_t *)0)
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
#ifdef NOTYET
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
aw_init(void)
return (AW_SUCCESS_RTN);
return (AW_SUCCESS_RTN);
a = param;
if (a != AW_USERD)
return (AW_SUCCESS_RTN);
if (a != AW_END) {
return (AW_ERR_RTN);
return (AW_SUCCESS_RTN);
aw_restore(void)
return (AW_SUCCESS_RTN);
return (AW_SUCCESS_RTN);
#ifdef DEBUG
static int cntr = 0;
FILE *f;
if (f == NULL) {
cntr++;
goto done;
a = (void *)param;
done:
(void) fclose(f);
return (NULL);
int err;
return (AW_ERR_RD_INVALID);
return (err);
aw_perror(const char *s)
int err;
if (bytes_left != 0) {