token.c revision 924c9144ce09475b72695d4f01dae8d8970412bd
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License, Version 1.0 only
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (the "License"). You may not use this file except in compliance
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Token processing for auditreduce.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int re_exec2(char *);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic char *collapse_path(char *s);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin switch (id) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* AUDIT_REC */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Process a token in a record to determine whether the record is interesting.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* AUDIT_REC */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* here if token id is not in table */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* There should not be any file or header tokens in the middle of a record */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* ARGSUSED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* ARGSUSED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* ARGSUSED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* ARGSUSED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* ARGSUSED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* ARGSUSED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ======================================================
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The following token processing routines return
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * -1: if the record is not interesting
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * -2: if an error is found
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ======================================================
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of arbitrary data token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * arbitrary data token id adr char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * how to print adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * basic unit adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * unit count adr_char, specifying number of units of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * data items depends on basic unit
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* get how_to_print, basic_unit, and unit_count */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; i < unit_count; i++) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* case AUR_BYTE: has same value as AUR_CHAR */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-2);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of opaque token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * opaque token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * size adr_short
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * data adr_char, size times
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of return32 value token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * return value token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * error number adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * return value adr_u_int32
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of return64 value token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * return value token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * error number adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * return value adr_u_int64
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of sequence token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * sequence token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * audit_count int32_t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of text token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * text token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * text adr_string
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of ip_addr token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ip token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * address adr_int32
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (-1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Format of ip_addr_ex token:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ip token id adr_char
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ip type adr_int32
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * address 4*adr_int32
char version;
char type;
short len;
short address;
int flag = 0;
if (flag)
short int number;
for (i = 0; i < number; i++) {
char arg_num;
char arg_num;
short cnt;
for (i = 0; i < cnt; i++)
for (i = 0; i < cnt; i++)
int count, i;
char *path;
switch (obj_flag) {
case OBJ_MSGGROUP:
case OBJ_MSGOWNER:
case OBJ_SEMGROUP:
case OBJ_SEMOWNER:
case OBJ_SHMGROUP:
case OBJ_SHMOWNER:
short socket_type;
short remote_port;
short socket_domain;
short socket_type;
short ip_size;
short local_port;
short remote_port;
char tid_type;
short rport;
short lport;
switch (tid_type) {
case AU_IPADR:
char *name;
collapse_path(char *s)
slashseen = 0;
--id;
if (slashseen) {
id--;
if (id > 0)
id--;
id++;
if (id > 0)
id--;
id++;
is--;
ushort_t c;
ushort_t c;
#ifndef TSOL
#ifdef TSOL
#ifndef TSOL
#ifdef TSOL
#ifndef TSOL
#ifdef TSOL
#ifndef TSOL
char flag;
#ifdef TSOL